Returns a message indicating why an ONC RPC routine failed. Format #include <rpc/rpc.h> char *clnt_sperror(CLIENT *handle, char *sp);
1 – Arguments
handle A pointer to the client handle used in the call that failed. sp A pointer to a string to be used as the beginning of the error message.
2 – Description
The clnt_sperror routine returns a pointer to a message string. The message consists of the sp parameter followed by an error message generated by calling the clnt_sperrno routine. Use this routine when the clnt_call routine fails. Use this routine if: o You want to save the string. o You do not want to use fprintf to print the message. o The message format is different from the one that clnt_perrno supports. The address that clnt_sperror returns is a pointer to its own internal string buffer. The clnt_sperror routine overwrites this buffer with each call. Therefore, you must copy the string to your own buffer if you wish to save the string.
3 – Return Values
char * A pointer to the message string terminated with a NULL character. NULL The routine was not able to allocate its internal buffer.