Purpose
Indicates why a client Remote Procedure Call (RPC) handle was not created.
Library
C Library (libc.a)
Syntax
#include <rpc/rpc.h>
void clnt_pcreateerror ( s)
char *s;
Description
The clnt_pcreateerror subroutine writes a message to standard error output, indicating why a client RPC handle could not be created. The message is preceded by the string pointed to by the s parameter and a colon.
Use this subroutine if one of the following calls fails: the clntraw_create subroutine, clnttcp_create subroutine, or clntudp_create subroutine.
Parameters
Item | Description |
---|---|
s | Points to a character string that represents the error text. |
Purpose
Prints an error message that is related to the creation of an RPC client handle to the standard error.
Library
Network Services Library (libnsl.a)
Syntax
#include <rpc/clnt.h>
void clnt_pcreateerror(error_msg)
const char * error_msg;
Description
Parameters
Item | Description |
---|---|
error_msg | Specified an error-message string that is provided by an application. |
Examples
In the following example, the clnt_create subroutine tries to register a program number that is not valid and hence will return a null value. The clnt_pcreateerror subroutine returns the actual error message, which is preceded by the specified string ("Invalid Program Number" ) and a colon.
#include <rpc/clnt.h>
#include <stdio.h>
int main()
{
CLIENT *cl;
char hostname[255] ; /* The name of remote host */
char *nettype = "visible" ;
rpcprog_t PROGNUM ; /* Invalid Value */
rpcvers_t PROGVER ;
cl = clnt_create(hostname, PROGNUM, PROGVER, nettype);
if(cl==NULL)
{
clnt_pcreateerror("Invalid Program Number ");
exit(1);
}
/*
* Make a call to clnt_call() subroutine
*/
/* Destroy the client handle at the end */
clnt_destroy(cl);
return 0;
}