Purpose
Copies error information from a client handle.
Library
C Library (libc.a)
Syntax
Description
The clnt_geterr macro copies error information from a client handle to an error structure.
Parameters
| Item | Description | 
|---|---|
| clnt | Points to the structure of the client handle. | 
| errp | Specifies the address of the error structure. | 
Purpose
Copies error information from a client handle.
Library
Network Services Library (libnsl.a)
Syntax
Description
The clnt_geterr macro copies error information from a client handle to an error structure.
Parameters
| Item | Description | 
|---|---|
| clnt | Points to the structure of the client handle. | 
| errp | Specifies the address of the error structure. | 
Examples
#include <stdlib.h>
#include <rpc/rpc.h>
#include <sys/time.h>
int main()
{
  rpcprog_t PROGNUM = 0x3fffffffL;
  rpcvers_t PROGVER = 0x1L;
  rpcproc_t procnum = 0x1L;
  CLIENT *clnt;
  enum clnt_stat cs;
  struct rpc_err client_error;
  char hostname[255] ; /* The Remote Host */
  char *nettype = "tcp";
  struct timeval total_timeout = {25,0};
  
  int input_arguments , output_results  ;  
  if ((clnt=clnt_create(hostname, PROGNUM, PROGVER, nettype))==NULL)
  {
    fprintf(stderr,"clnt_create() subroutine failed");
    exit(1);
  }
  cs = clnt_call(clnt, procnum, (xdrproc_t)xdr_int,
           (char *)&input_arguments, (xdrproc_t)xdr_int,
           (char *)&output_results, total_timeout);
  if (cs != RPC_SUCCESS)
      clnt_geterr(clnt,&client_error);
  /* Destroy client handle in the end */
  clnt_destroy(clnt);
  return 0;
}