clnt_geterr()--Get the Error Structure from the Client Handle


  Syntax

 #include <rpc/rpc.h>

 void clnt_geterr(const CLIENT *clnt,
                              struct rpc_err *errp);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The clnt_geterr() function copies the error structure out of the client handle to the structure at address errp.


Parameters

clnt  (Input) 
A pointer to the client handle.

errp  (Output) 
A pointer to the error structure.

Authorities

No authorization is required.


Return Value

None.


Error Conditions

When an exception occurs, clnt_geterr() tries to set RPC_INTR in the client handle. This status can be retrieved by another valid clnt_geterr() call. If the attempt was unsuccessful, no error indication is given.


Error Messages

Message ID Error Message Text
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


Example

See Code disclaimer information for information pertaining to code examples.

The following example shows how clnt_geterr() 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(clnt,&client_error);
    ...
    exit(1);
  }
}



API introduced: V4R2
Top | Remote Procedure Call (RPC) APIs | APIs by category