Creates a remote procedure call (RPC) handle for raw interfaces.
Network Services Library (libnsl.a)
#include <rpc/rpc.h>
SVCXPRT *svc_raw_create (void)
The svc_raw_create subroutine is a bottom-level API for transport-independent remote procedure calls (TI_PRC). Bottom-level APIs provide a full control over the transport options. This subroutine creates an RPC service handle for raw interfaces. The transport type is a buffer in the address space of the process. Thus the client must be in the same address space. This subroutine provides simulation of the RPC service with all RPC overheads without actually using any network interface. This subroutine does not register a server with an RPC service package because the program number and version number are not specified.
Item | Description |
---|---|
an PRC service handle | successful |
NULL | unsuccessful |
#include <stdlib.h>
#include <rpc/rpc.h>
#include <netconfig.h>
main()
{
SVCXPRT *svc_handle; /* server handle */
/* create server handle using svc_raw_create */
if((svc_handle=svc_raw_create())==(SVCXPRT *)NULL)
{
fprintf(stdout,"Error in svc_raw_create!");
exit(EXIT_FAILURE);
}
/* Note that transport type passed to svc_reg() is NULL */
if(svc_reg(svc_handle, PROG, VERS, sample_dispatch, NULL) == 0)
{
fprintf(stdout,"Error in svc_reg!");
exit(EXIT_FAILURE);
}
/* note that here svc_run() is not called */
/* To call registered procedure, client should be in same address space */
return 0;
}
/* following is the sample dispatch routine*/
static void sample_dispatch(struct svc_req *request, SVCXPRT *xprt)
{
/* dispatch routine code */
}