Using the callrpc Routine
The RPC callrpc routine executes remote procedure calls.
See Using the Intermediate Layer of RPC Example.
The callrpc routine includes the following parameters:
- Name of the remote server workstation
- Program number
- Version number of the program
- Procedure number
- Input XDR filter primitive
- Argument to be encoded and passed to the remote procedure
- Output XDR filter for decoding the results returned by the remote procedure
- Pointer to the location where the procedure's results are to be stored
Multiple arguments and results can be embedded in structures. If the callrpc routine completes successfully, it returns a value of zero. Otherwise, it returns a nonzero value. The return codes are cast in integer data-type values in the rpc/clnt.h file.
If the callrpc routine gets no answer after several attempts to deliver a message, it returns with an error code. The delivery mechanism is UDP. Adjusting the number of retries or using a different protocol requires the use of the lower layer of the RPC library.