RPC_SVC_CREATE(3N)

NAME
svc_destroy, svcfd_create, svcraw_create, svctcp_create, svcudp_bufcreate - library routines for dealing with the creation of server handles

DESCRIPTION

RPC routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a request to the server. Upon receipt of the request, the server calls a dispatch routine to perform the requested service, and then sends back a reply. Finally, the procedure call returns to the client.

The SVCXPRT data structure is defined in the RPC/XDR Library Definitions of the

#include <rpc/rpc.h>

void svc_destroy(xprt)
SVCXPRT *xprt;

    Destroy the RPC service transport handle, xprt. Destruction usually involves deallocation of private data structures, including xprt itself. Use of xprt is undefined after calling this routine.

SVCXPRT * svcfd_create(fd, sendsz, recvsz)
int fd;
u_int sendsz;
u_int recvsz;

    Create a service on top of any open and bound descriptor and return the handle to it. Typically, this descriptor is a connected socket for a stream protocol such as TCP. sendsz and recvsz indicate sizes for the send and receive buffers. If they are zero, a reasonable default is chosen. It returns NULL if it fails.

SVCXPRT * svcraw_create()

    This routine creates a RPC service transport, to which it returns a pointer. The transport is a buffer within the process's address space, so the corresponding RPC client must live in the same address space; see clntraw_create() on rpc_clnt_create(3N). This routine allows simulation of RPC and getting RPC overheads (such as round trip times), without any kernel interference. This routine returns NULL if it fails.

SVCXPRT * svctcp_create(sock, sendsz, recvsz)
int sock;
u_int sendsz, recvsz;

    This routine creates a TCP/IP-based RPC service transport, to which it returns a pointer. The transport is associated with the socket sock. If sock is RPC_ANYSOCK, then a new socket is created. If the socket is not bound to a local TCP port, then this routine binds it to an arbitrary port. Upon completion, xprt->xp_sock is the transport's socket descriptor, and xprt->xp_port is the port number on which it is listening. This routine returns NULL if it fails. Since TCP-based RPC uses buffered I/O, users may specify the size of buffers with sendsz and recvsz; values of zero choose defaults.

SVCXPRT * svcudp_bufcreate(sock, sendsz, recvsz)
int sock;
u_int sendsz, recvsz;

    This routine creates a UDP/IP-based RPC service transport, to which it returns a pointer. The transport is associated with the socket sock. If sock is RPC_ANYSOCK , then a new socket is created. If the socket is not bound to a local UDP port, then this routine binds it to an arbitrary port. Upon completion, xprt->xp_sock is the service's socket descriptor, and xprt->xp_port is the service's port number. This routine returns NULL if it fails.

    The user specifies the maximum packet size for sending and receiving UDP-based RPC messages by using the sendsz and recvsz parameters.

SEE ALSO
rpc(3N), rpc_clnt_create(3N), rpc_svc_calls(3N), rpc_svc_err(3N), rpc_svc_reg(3N), portmap(8C)