clnt_call()--Call a Remote Procedure Associated with the Client


  Syntax

 #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);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

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.


Parameters

clnt  (Input) 
A pointer to the client handle structure that results from calling a client creation function that uses a Remote Procedure Call (RPC) such as the clnt_create() API.

procnum  (Input) 
The procedure on the host machine.

inproc  (Input) 
The name of the XDR procedure that encodes the procedure parameters.

in  (Input) 
The address of the procedure arguments.

outproc  (Input) 
The name of the XDR procedure that decodes the procedure results.

out  (Output) 
The address where results are placed.

tout  (Input) 
The time allowed for the server to respond.

Authorities

None.


Return Value



Error Conditions

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:



Error Messages



Related Information


Example

The following example shows how clnt_call() is used.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#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);
  }
}


API introduced: V4R2

[ Back to top | Remote Procedure Call (RPC) APIs | APIs by category ]