svc_dg_create Subroutine

Purpose

Creates a remote procedure call (RPC) service handle for a connectionless transport.

Library

Network Services Library (libnsl.a)

Syntax

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

Description

The svc_dg_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. The subroutine creates an RPC service handle for a connectionless transport. You can use this handle for procedures that accept a small number of arguments or return small values, because connectionless messages can hold limited amount of data. This subroutine does not register a server with RPC services 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 RPC service handle successful
NULL unsuccessful

Examples

#include <stdlib.h>
#include <rpc/rpc.h>

main()
{
      SVCXPRT *svc_handle;      /* server handle */
      int fd; 

      /* Get proper file descriptor */                     
  
      /* sendsize and recvsize are 0, thus default size will be chosen */
                     
      if((svc_handle = svc_dg_create(fd, 0, 0))==(SVCXPRT *)NULL)
      {
                 fprintf(stdout,"Error in svc_dg_create!");
                 exit(EXIT_FAILURE);
      }
  
      /* Register RPC service */
      
      svc_run();
      return 0;
}