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

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 routine
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 application
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)).
Client-side routines are MT-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).
Server-side routines are mostly MT-Unsafe. In this implementation 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 MT 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 2: December 2007 Update 1 Hewlett-Packard Company 327