rpc.3n (2010 09)
r
rpc(3N) rpc(3N)
NAME
rpc - library routines for remote procedure calls
SYNOPSIS
cc [ flag ]... file...
-lnsl [ library ]...
#include <rpc/rpc.h>
#include <netconfig.h>
DESCRIPTION
These routines allow C language programs to make procedure calls on other machines across a network.
First, the client sends a request to the server. On receipt of the request, the server calls a dispatch rou-
tine to perform the requested service, and then sends back a reply.
All RPC routines require the header
<rpc/rpc.h>
. Routines that take a netconfig structure also
require that
<netconfig.h>
be included. Applications using RPC and XDR routines should be linked
with the
libnsl library.
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.
Multithread Considerations
In the case of multithreaded applications, the
_REENTRANT flag must be defined on the command line at
compilation time (
-D_REENTRANT). Defining this flag enables a thread-specific version of
rpc_createerr (see rpc_clnt_create(3N)).
When used in multithreaded applications, client-side routines are thread-safe. CLIENT handles (see
rpc_clnt_create(3N)) can be shared between threads; however, in this implementation requests by
different threads are serialized (that is, the first request will receive its results before the second request
is sent).
When used in multithreaded applications, server-side routines are usually not thread-safe. In this imple-
mentation the service transport handle,
SVCXPRT (see rpc_svc_create(3N)), contains a single data area
for decoding arguments and encoding results. Therefore, this structure cannot be freely shared between
threads that call functions that do this. Routines that are affected by this restriction are marked as
unsafe for multithreaded applications (see rpc_svc_calls(3N)).
See the MULTITHREAD USAGE section of the routines’ respective manual pages.
Nettype
Some of the high-level RPC interface routines take a nettype string as one of the parameters (for example,
clnt_create(), svc_create(),
rpc_reg(), rpc_call()). This string defines a class of tran-
sports which can be used for a particular application.
nettype can be one of the following:
netpath Choose from the transports which have been indicated by their token names in the NET-
PATH environment variable. If NETPATH is unset or NULL, it defaults to visible.
netpath is the default nettype .
visible Choose the transports which have the visible flag (v) set in the /etc/netconfig file.
circuit_v This is same as visible except that it chooses only the connection oriented transports
(semantics tpi_cots or tpi_cots_ord) from the entries in the /etc/netconfig
file.
datagram_v This is same as visible except that it chooses only the connectionless datagram tran-
sports (semantics tpi_clts) from the entries in the /etc/netconfig file.
circuit_n This is same as netpath except that it chooses only the connection oriented datagram
transports (semantics tpi_cots or tpi_cots_ord).
datagram_n This is same as netpath except that it chooses only the connectionless datagram tran-
sports (semantics tpi_clts).
udp This refers to Internet UDP.
tcp This refers to Internet TCP.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1