The svc_register() call registers procedures on the local Portmapper.
Syntax
#include <rpc\rpc.h> #include <netdb.h> bool_t svc_register(xprt, prognum, versnum, dispatch, protocol) SVCXPRT *xprt; u_long prognum; u_long versnum; void (*dispatch) (); int protocol;
Parameters
xprt
dispatch(request, xprt) struct svc_req *request; SVCXPRT *xprt;protocol
Description
The svc_register() call associates the specified program with the service dispatch routine dispatch.
Note: When you use a toy RPC service transport created with svcraw_create(), make a call to xprt_register() immediately after a call to svc_register().
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; /* register the remote program with local Portmapper */ if (!svc_register(transp, RMTPROGNUM, RMTPROGVER, rmtprog, IPPROTO_UDP)) { fprintf(stderr, "can't register rmtprog() service\n"); exit(-1); }
/* code for remote program; rmtprog */ rmtprog(rqstp, transp) struct svc_req *rqstp; SVCXPRT *transp; { ... }
Related Calls