#include <rpc/rpc.h>
enum clnt_stat clnt_call(CLIENT *clnt,
const u_long procnum,
const xdrproc_t inproc,
const caddr_t in,
const xdrproc_t outproc,
caddr_t out,
const struct timeval tout);
The clnt_call() API calls the remote procedure that is associated with the client handle pointed to by the clnt parameter.
The caller of the clnt_call() API must pass a valid client handle obtained from a successful call to the clnt_create() API.
None
| RPC_SUCCESS (0) | Successful |
| Non-zero value | clnt_call() was not successful. |
Upon failure, clnt_call() sets a private field in the client handle. This field has a type 'struct rpc_err', and can be accessed by the clnt_geterr() function.
The re_status field can be set to one of the following values:
| [RPC_AUTHERROR] | Authentication error. Server's response did not pass authentication validation. | ||||||||||
| [RPC_CANTDECODERES] | The outproc XDR function has failed. | ||||||||||
| [RPC_CANTENCODEARGS] | The inproc XDR function has failed. | ||||||||||
| [RPC_CANTRECV] | Failure in receiving result. RPC is unable to
receive server's response. The re_errno field is set to the value
returned from the failed call.
|
||||||||||
| [RPC_CANTSEND] | Failure in sending call. RPC is unable to send a
request. The re_errno field is set to the value returned from the
failed call.
|
||||||||||
| [RPC_FAILED] | The tout parameter is not set properly. | ||||||||||
| [RPC_INTR] | Interrupted RPC call. An exception has occurred in the RPC API. The re_errno field is set to EUNKNOWN. | ||||||||||
| [RPC_TIMEDOUT] | RPC call is timed out. The client cannot receive a response in the specified timeout period. | ||||||||||
| [RPC_PROGVERSMISNATCH] | There are no registered versions for the program. | ||||||||||
| [RPC_PROGNOTREGISTERED] | The program is not registered with the server. | ||||||||||
| [RPC_PROGUNAVAIL] | The program is not registered with the server. |
| Message ID | Error Message Text |
|---|---|
| CPIA1B1 I | A problem was encountered in the RPC client. |
| CPIA1B2 I | TI-RPC encountered a problem in the transport protocol. |
| CPE3418 E | Possible APAR condition or hardware failure. |
| CPF3CF2 E | Error(s) occurred during running of &1 API. |
| CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
See Code disclaimer information for information pertaining to code examples.
The following example shows how clnt_call() is used:
#include <stdio.h>
#include <rpc/rpc.h>
#include <sys/time.h>
main()
{
u_long procnum;
CLIENT *clnt;
enum clnt_stat cs;
struct rpc_err client_error;
struct timeval total_timeout;
int intsend, intrecv;
...
/* Call the remote procedure that is associated with client */
cs = clnt_call(clnt, procnum, xdr_int,
(caddr_t)&intsend, xdr_int,
(caddr_t)&intrecv, total_timeout);
if (cs != RPC_SUCCESS){
clnt_geterr(client,&client_error);
...
exit(1);
}
}
| Top | Remote Procedure Call (RPC) APIs | APIs by category |