svc_vc_create Subroutine

Purpose

Creates a remote procedure call (RPC) service handle for connection-oriented transport.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
SVCXPRT *svc_vc_create(fd, sendsize, recvsize)
int fd;
const uint_t sendsize;
const uint_t recvsize;

Description

The svc_vc_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 connection-oriented transport. This subroutine does not register a server with an RPC service package because the program number and version number are not specified.

Parameters

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.

Return Values

Item Description
an PRC service handle successful
NULL unsuccessful

Examples

#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_vc_create(fd, 0, 0))==(SVCXPRT *)NULL)
       {
                 fprintf(stdout,"Error in svc_vc_create!");
                 exit(EXIT_FAILURE);
       }
  
       /* Register RPC service */
              
       svc_run();
       return 0;
}