Holds the status of a client-handle-creation subroutine for a remote procedure call (RPC).
Network Services Library (libnsl.a)
#include <rpc/rpc.h>
struct rpc_createerr rpc_createerr
Whenever a client-creation subroutine fails, the subroutine sets the value of the rpc_createerr global variable to an appropriate error code. The clnt_pcreateerror and clnt_spcreateerror subroutines use this global variable to display the failure reason.
In the following example, the rpc_createerr global variable is used to display the error code.
#include <stdlib.h>
#include <rpc/rpc.h>
int main()
{
CLIENT *cl;
rpcprog_t PROGNUM = 0x3fffffffL;
rpcvers_t PROGVER = 0x1L;
char *nettype = "visible";
char hostname[255] ; /* The name of remote host */
/*
* make the clnt_create call with this nettype and
* observe the result
*/
if ((cl=clnt_create( hostname, PROGNUM, PROGVER, nettype)) == NULL)
{
fprintf(stdout, "The error status : %d\n" , rpc_createerr.cf_stat);
exit(EXIT_FAILURE);
}
/* destroy the client handle */
clnt_destroy(cl);
return 0;
}