clnt_raw_create Subroutine

Purpose

Creates and returns a generic client handle for the specified program and version.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
CLIENT * clnt_raw_create( prognum, versnum )
const rpcprog_t prognum;
const rpcvers_t versnum;

Description

The clnt_raw_create subroutine creates and returns a generic client handle for the specified program and version. For this subroutine, the server must be in the same address space as the client because the transport that is used for the client-server communication is the buffer in the process-address space of the client. This facilitates measurement of remote procedure call (RPC) overheads, such as round trip times, without any kernel or networking interference.

Parameters

Item Description
prognum Specifies the program number of the remote program.
versnum Specifies the version number of the remote program.

Return Values

Item Description
a generic client handle that is valid successful
NULL unsuccessful

Error Codes

The clnt_raw_create subroutine returns failure when one or more of the following error codes are true.

Item Description
RPC_PROGNOTREGISTERED The program number is not valid.
RPC_PROGVERSMISMATCH The version number is not valid.

Examples

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

int main()
{
    CLIENT *cl;
    rpcprog_t PROGNUM = 0x3fffffffL;
    rpcvers_t PROGVER = 0x1L ;

    /*
    * make the clnt_door_create call with this nettype and
    * observe the result
    */

    if ((cl=clnt_raw_create( PROGNUM, PROGVER ) == NULL)
    {
          fprintf(stdout, "clnt_raw_create : failed.\n");
          exit(EXIT_FAILURE);
    }

    /*
     * Make a call to clnt_call() subroutine 
     */

    /* Destroy client handle in the end */
    clnt_destroy(cl);

    return 0;
}