HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

r
rpc_clnt_create(3N) rpc_clnt_create(3N)
Note: If you set the timeout value to
0 clnt_call() immediately returns an error
(
RPC_TIMEDOUT ). Set the timeout parameter to
0 for batching calls.
CLGET_FD int * get the associated file descriptor
CLGET_SVC_ADDR struct netbuf * get servers address
CLSET_FD_CLOSE void * close the file descriptor
when destroying the client handle
(see clnt_destroy())
CLSET_FD_NCLOSE void do not close the file descriptor
when destroying the client handle
CLGET_VERS unsigned long * get the
RPC
program’s
version number associated with the
client handle
CLSET_VERS unsigned long * set the RPC program’s version
number associated with the
client handle. This assumes
that the
RPC server for
this new version is still
listening at the address of the
previous version.
CLGET_XID unsigned long * get the XID of the previous
remote procedure call
CLSET_XID unsigned long * set the XID of the next
remote procedure call
The following operations are valid for connectionless transports only:
CLSET_RETRY_TIMEOUT struct timeval * set the retry timeout
CLGET_RETRY_TIMEOUT struct timeval * get the retry timeout
The retry timeout is the time that RPC waits for the server to reply before retransmitting the request.
clnt_control() returns TRUE
on success and FALSE on failure.
CLIENT *clnt_create()
Generic client creation routine for program prognum and version versnum. host identifies the name
of the remote host where the server is located. nettype indicates the class of transport protocol to use.
The transports are tried in left to right order in NETPATH variable or in top to bottom order in the
netconfig database.
clnt_create() tries all the transports of the nettype class available from the NETPATH environ-
ment variable and the netconfig database, and chooses the first successful one. A default timeout is
set and can be modified using clnt_control()
. This routine returns NULL if it fails. The
clnt_pcreateerror()
routine can be used to print the reason for failure.
Note:
clnt_create() returns a valid client handle even if the particular version number supplied
to
clnt_create() is not registered with the
rpcbind service. This mismatch will be discovered
by a
clnt_call later (see rpc_clnt_calls(3N)).
CLIENT *clnt_create_vers()
Generic client creation routine which is similar to clnt_create() but which also checks for the
version availability. host identifies the name of the remote host where the server is located. nettype
indicates the class transport protocols to be used. If the routine is successful it returns a client handle
created for the highest version between vers_low and vers_high that is supported by the server.
vers_outp is set to this value. That is, after a successful return vers_low <= *vers_outp <= vers_high.
If no version between vers_low and vers_high is supported by the server then the routine fails and
returns
NULL. A default timeout is set and can be modified using clnt_control( ). This routine
returns
NULL if it fails. The clnt_pcreateerror() routine can be used to print the reason for
failure.
Note: clnt_create() returns a valid client handle even if the particular version number supplied
to clnt_create() is not registered with the rpcbind service. This mismatch will be discovered
by a clnt_call later (see rpc_clnt_calls(3N)). However, clnt_create_vers() does this for
you and returns a valid handle only if a version within the range supplied is supported by the server.
void clnt_destroy()
A function macro that destroys the client’s RPC handle. Destruction usually involves deallocation of
HP-UX 11i Version 2: December 2007 Update − 2 − Hewlett-Packard Company 339