rpc_clnt_create.3n (2010 09)
r
rpc_clnt_create(3N) rpc_clnt_create(3N)
CLIENT *clnt_tp_create_timed(const char *
host ,
const rpcprog_t prognum,
const rpcvers_t versnum ,
const struct netconfig *netconf ,
const struct timeval *timeout );
CLIENT *clnt_vc_create(const int
fildes
,
const struct netbuf *
svcaddr ,
const rpcprog_t prognum,
const rpcvers_t versnum ,
const u_int sendsz,
const u_int recvsz );
struct rpc_createerr rpc_createerr;
DESCRIPTION
RPC library routines allow C language programs to make procedure calls on other machines across the
network. First a CLIENT handle is created and then the client calls a procedure to send a request to the
server. On receipt of the request, the server calls a dispatch routine to perform the requested service,
and then sends a reply.
These routines are thread-safe. In the case of multithreaded applications, the
_REENTRANT flag must be
defined on the command line at compilation time (
-D_REENTRANT). When the _REENTRANT
flag is
defined,
rpc_createerr becomes a macro which enables each thread to have its own
rpc_createerr.
The HP-UX implementation of RPC only supports the X/Open Transport Interface (XTI). Applications
that are written using the Transport Layer Interface (TLI) and wish to use RPC, must convert their appli-
cation to XTI.
Routines
See rpc (3N) for the definition of the
CLIENT data structure.
bool_t clnt_control();
A function macro to change or retrieve various information about a client object. req indicates the
type of operation, and info is a pointer to the information. For both connectionless and connection-
oriented transports, the supported values of req and their argument types and what they do are:
CLSET_TIMEOUT struct timeval * set total timeout
CLGET_TIMEOUT struct timeval * get total timeout
If the timeout is set using
clnt_control()
, the timeout argument passed by clnt_call() is
ignored in all subsequent calls.
If the timeout value is set to
0, clnt_control()
immediately returns RPC_TIMEDOUT. Set the
timeout parameter to
0 for batching calls.
CLGET_SERVER_ADDR struct netbuf * get server’s address
CLGET_SVC_ADDR struct netbuf * get server’s address
CLGET_FD int * get the associated file descriptor
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 rpcvers_t get the RPC program’s version
number associated with the
client handle
CLSET_VERS rpcvers_t 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
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010