The svc_sendreply() call sends the results of an RPC to the caller.
Syntax
#include <rpc\rpc.h> bool_t svc_sendreply(xprt, outproc, out) SVCXPRT *xprt; xdrproc_t outproc; char *out;
Parameters
xprt
Description
The service dispatch routine calls the svc_sendreply() call to send the results of the call to the caller.
Return Values
The value 1 indicates success; the value 0 indicates an error.
Examples
#define RMTPROGNUM (u_long)0x3fffffffL#define RMTPROGVER (u_long)0x1L ... SVCXPRT *transp; transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf(stderr, "can't create an RPC server transport\n"); exit(-1); } pmap_unset(RMTPROGNUM, RMTPROGVER); if (!svc_register(transp, RMTPROGNUM, RMTPROGVER, rmtprog, IPPROTO_UDP)) { fprintf(stderr, "can't register rmtprog() service\n"); exit(-1); } printf("rmtprog() service registered.\n"); svc_run(); printf("Error:svc_run should never reach this point \n"); exit(1); ...
rmtprog(rqstp, transp) struct svc_req *rqstp; SVCXPRT *transp; { int intrecv; int replysend; switch((int)rqstp->rq_proc) { case PROCNUM0: svc_getargs(transp, xdr_int, &intrecv); ... /* process intrecv parameter */ replysend = ( intrecv * 1000) + 100; /* send reply to client */ if (!svc_sendreply(transp, xdr_int, &replysend)) { fprintf(stderr,"can't reply to RPC call\n"); exit(-1); } return; case PROCNUM1: ... } ... }