Executes a remote procedure call. Format #include <rpc/rpc.h> int callrpc(char *host, u_long prognum, u_long versnum, u_long procnum, xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
1 – Arguments
host A pointer to the name of the host on which the remote procedure resides. prognum The program number associated with the remote procedure. versnum The version number associated with the remote procedure. procnum The procedure number associated with the remote procedure. inproc The XDR routine used to encode the remote procedure's arguments. in A pointer to the remote procedure's arguments. outproc The XDR routine used to decode the remote procedure's results. out A pointer to the remote procedure's results.
2 – Description
Calls the remote procedure associated with prognum, versnum, and procnum on the host host. This routine performs the same functions as a set of calls to the clnt_create, clnt_call, and clnt_destroy routines. This routine returns RPC_SUCCESS if it succeeds, or the value of enum clnt_stat cast to an integer if it fails. The routine clnt_perrno is handy for translating a failure status into a message. NOTE Calling remote procedures with this routine uses UDP/IP as a transport; see clntudp_create for restrictions. You do not have control of timeouts or authentication using this routine. If you want to use the TCP transport, use the clnt_ create or clnttcp_create routine.
3 – Return Values
RPC_SUCCESS Indicates success. clnt_stat Returns a value of type enum clnt_stat cast to type int containing the status of the callrpc operation.