clnttcp_create(3) CLIX clnttcp_create(3)
NAME
clnttcp_create, clntudp_create - Library functions for remote procedure
calls
LIBRARY
Berkeley Software Distribution Library (libbsd.a)
SYNOPSIS
CLIENT * clnttcp_create(
struct sockaddr_in *addr ,
ulong prognum ,
ulong versnum ,
int *sockp ,
uint sendsz ,
uint recvsz );
CLIENT * clntudp_create(
struct sockaddr_in *addr ,
ulong prognum ,
ulong versnum ,
struct timeval wait ,
int *sockp );
PARAMETERS
addr Points to the Internet address of the machine executing remote
server.
prognum Specifies the program number of the target server.
versnum Specifies the version number of the target server.
sockp Points to an existing socket to use; rpc_anysock() requests for
a new socket to be created and used.
sendsz Specifies the size of the send buffer. A value of 0 requests
that a suitable default size be chosen.
recvsz Specifies the size of the receive buffer. A value of 0 requests
that a suitable default size be chosen.
wait Specifies the amount of time between retries.
DESCRIPTION
The clnttcp_create() and clntudp_create() functions allow C programs to
make procedure calls on other machines across the network. First, the
client calls a procedure to send a data packet to the server. Upon
2/94 - Intergraph Corporation 1
clnttcp_create(3) CLIX clnttcp_create(3)
receipt of the packet, the server calls a dispatch routine to perform the
requested service, and then sends back a reply. Finally, the procedure
call returns to the client.
The clnttcp_create() function creates an RPC client for the remote program
prognum, version versnum. The client uses TCP/IP as a transport. The
remote program is located at Internet address *addr. If addr->sin_port is
0, it is set to the actual port that the remote program is listening on
(the remote portmap service is consulted for this information). The sockp
parameter is a socket; if its value is RPC_ANYSOCK, this function opens a
new one and sets sockp. Since TCP-based RPC uses buffered I/O, the user
may specify the size of the send and receive buffers with the parameters
sendsz and recvsz; values of 0 choose suitable defaults.
The clntudp_create() function creates an RPC client for the remote program
prognum, version versnum. The client uses use UDP/IP as a transport. The
remote program is located at Internet address addr. If addr->sin_port is
0, it is set to the actual port that the remote program is listening on.
(The remote portmap service is consulted for this information.) The sockp
parameter is a socket. If its value is RPC_ANYSOCK, this function opens a
new one and sets sockp. The UDP transport resends the call message in
intervals of wait time until a response is received or until the call
times out. The total time for the call to time out is specified by
clnt_call.
CAUTIONS
Since UDP-based RPC messages can only hold up to 8 kilobytes of encoded
data, this transport cannot be used for procedures that take large
arguments or return huge results.
RETURN VALUES
The clnttcp_create() and clntudp_create() functions return NULL if
unsuccessful, and a valid CLIENT handle if successful.
RELATED INFORMATION
Functions: xdr_int(3), xdr_bytes(3), xdr_getpos(3), xdr_pointer(3),
xdrrec_create(3), xdr_array(3), xdr_destroy(3), xdr_free(3),
xdr_inline(3), xdrmem_create(3), xdr_opaque(3), xdr_union(3),
xdr_vector(3), xdr_void(3)
CLIX Programming Guide
2 Intergraph Corporation - 2/94