Specifications

Remote Procedure Call Programming Guide Page 15
argument, a pointer to the argument, the XDR routine for deserializing the return value, a pointer to where
the return value will be placed, and the time in seconds to wait for a reply.
The CLIENT pointer is encoded with the transport mechanism. callrpc() uses UDP, thus it calls
clntudp_create() to get a CLIENT pointer. To get TCP (Transmission Control Protocol), you would use
clnttcp_create().
The parameters to clntudp_create() are the server address, the program number, the version number, a time-
out value (between tries), and a pointer to a socket. The final argument to clnt_call() is the total time to
wait for a response. Thus, the number of tries is the clnt_call() timeout divided by the clntudp_create()
timeout.
Note that the clnt_destroy() call always deallocates the space associated with the CLIENT handle. It closes
the socket associated with the CLIENT handle, however, only if the RPC library opened it. It the socket
was opened by the user, it stays open. This makes it possible, in cases where there are multiple client han-
dles using the same socket, to destroy one handle without closing the socket that other handles are using.
To make a stream connection, the call to clntudp_create() is replaced with a call to clnttcp_create().
clnttcp_create(&server_addr, prognum, versnum, &sock,
inputsize, outputsize);
There is no timeout argument; instead, the receive and send buffer sizes must be specified. When the
clnttcp_create() call is made, a TCP connection is established. All RPC calls using that CLIENT handle
would use this connection. The server side of an RPC call using TCP has svcudp_create() replaced by
svctcp_create().
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
The last two arguments to svctcp_create() are send and receive sizes respectively. If ‘0’ is specified for
either of these, the system chooses a reasonable default.