Creates a remote procedure call (RPC) service handle on an open and bound file descriptor.
Network Services Library (libnsl.a)
#include <rpc/rpc.h>
SVCXPRT *svc_fd_create(fd, sendsize, recvsize)
int fd;
const uint_t sendsize;
const uint_t recvsize;
The svc_fd_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 a service handle over a given file descriptor. The file descriptor must be open and bound that is connected to a connection-oriented transport. This subroutine does not register a server with RPC services because the program number and version number are not specified. The size of the send and receive buffers can be specified by the sendsize and recvsize parameters. If the values of the sendsize and recvsize parameters are set to 0, the default size is used for buffers.
Item | Description |
---|---|
fd | Indicates an open file descriptor that is bound. |
sendsize | Specify the send buffer size. If the value is set to 0, the default size for that transport is used. |
recvsize | Specify the receive buffer size. If the value is set to 0, the default size for that transport is used. |
Item | Description |
---|---|
an PRC service handle | successful |
NULL | unsuccessful |
#include <stdlib.h>
#include <rpc/rpc.h>
main()
{
SVCXPRT *svc_handle; /* server handle */
int fd; /* file descriptor */
/* Get proper file descriptor */
/* sendsize and recvsize are 0, thus default size will be chosen */
if((svc_handle = svc_fd_create(fd, 0, 0))==(SVCXPRT *)NULL)
{
fprintf(stdout,"Error in svc_fd_create!");
exit(EXIT_FAILURE);
}
/* Register RPC service */
svc_run();
return 0;
}