22 dispatch(struct svc_req
*request
, SVCXPRT
*xprt
)
24 svc_sendreply(xprt
, (xdrproc_t
)xdr_void
, 0);
25 if (request
->rq_proc
== PROCQUIT
)
30 test_one_call (struct rpc_arg
*a
)
32 struct timeval tout
= { 60, 0 };
33 enum clnt_stat result
;
35 printf ("test_one_call: ");
36 result
= clnt_call (a
->client
, a
->proc
,
37 (xdrproc_t
) xdr_void
, 0,
38 (xdrproc_t
) xdr_void
, 0, tout
);
39 if (result
== RPC_SUCCESS
)
50 thread_wrapper (void *arg
)
54 a
.client
= (CLIENT
*)arg
;
57 a
.client
= (CLIENT
*)arg
;
71 struct sockaddr_in sin
;
72 struct timeval wait
= { 5, 0 };
73 int sock
= RPC_ANYSOCK
;
76 svx
= svcudp_create (RPC_ANYSOCK
);
77 svc_register (svx
, PROGNUM
, VERSNUM
, dispatch
, 0);
88 inet_aton ("127.0.0.1", &sin
.sin_addr
);
89 sin
.sin_port
= htons (svx
->xp_port
);
90 sin
.sin_family
= AF_INET
;
92 clnt
= clntudp_create (&sin
, PROGNUM
, VERSNUM
, wait
, &sock
);
97 /* Test in this thread */
100 /* Test in a child thread */
101 err
= pthread_create (&tid
, 0, thread_wrapper
, (void *) clnt
);
103 fprintf (stderr
, "pthread_create: %s\n", strerror (err
));
104 err
= pthread_join (tid
, 0);
106 fprintf (stderr
, "pthread_join: %s\n", strerror (err
));