clnt_door_create Subroutine

Purpose

Creates and returns a generic client handle for a program over the doors-transport mechanism.

Library

Network Services Library (libnsl.a)

Syntax

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

Description

The clnt_door_create subroutine creates and returns a generic client handle for the specified program and version. The subroutine creates the client handle over the doors-transport mechanism that can accelerate the data transfer between different processes on the same machine. If you set the size of the send buffer that is specified by the sendsize parameter to 0, the default size of 16KB is used.

Parameters

Item Description
prognum Specifies the program number of the remote program.
versnum Specifies the version number of the remote program.
sendsize Specifies the size of the send buffer.

Return Values

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

Error Codes

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

Item Description
RPC_UNKNOWNHOST The host name 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_door_create( PROGNUM, PROGVER, 0)) == NULL)
    {
         fprintf(stdout, "clnt_door_create : failed.\n");
         exit(EXIT_FAILURE);
    }

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

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

    return 0;
}