{
    "mode": "man",
    "parameter": "rpc_clnt_calls",
    "section": "3",
    "url": "https://www.chedong.com/phpMan.php/man/rpc_clnt_calls/3/json",
    "generated": "2026-06-15T14:34:23Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "rpcclntcalls, clntcall, clntfreeres, clntgeterr, clntperrno, clntperror, clntsperrno,\nclntsperror, rpcbroadcast, rpcbroadcastexp, rpccall — library routines for client side\ncalls\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "#include <rpc/rpc.h>",
                    "content": "enum clntstat\nclntcall(CLIENT *clnt, const rpcproct procnum, const xdrproct inproc, const caddrt in,\nconst xdrproct outproc, caddrt out, const struct timeval tout);\n\nboolt\nclntfreeres(CLIENT *clnt, const xdrproct outproc, caddrt out);\n\nvoid\nclntgeterr(const CLIENT * clnt, struct rpcerr * errp);\n\nvoid\nclntperrno(const enum clntstat stat);\n\nvoid\nclntperror(CLIENT *clnt, const char *s);\n\nchar *\nclntsperrno(const enum clntstat stat);\n\nchar *\nclntsperror(CLIENT *clnt, const char * s);\n\nenum clntstat\nrpcbroadcast(const rpcprogt prognum, const rpcverst versnum, const rpcproct procnum,\nconst xdrproct inproc, const caddrt in, const xdrproct outproc, caddrt out,\nconst resultproct eachresult, const char *nettype);\n\nenum clntstat\nrpcbroadcastexp(const rpcprogt prognum, const rpcverst versnum, const rpcproct procnum,\nconst xdrproct xargs, caddrt argsp, const xdrproct xresults, caddrt resultsp,\nconst resultproct eachresult, const int inittime, const int waittime,\nconst char * nettype);\n\nenum clntstat\nrpccall(const char *host, const rpcprogt prognum, const rpcverst versnum,\nconst rpcproct procnum, const xdrproct inproc, const char *in, const xdrproct outproc,\nchar *out, const char *nettype);\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "RPC library routines allow C language programs to make procedure calls on other machines across\nthe network.  First, the client calls a procedure to send a request to the server.  Upon re‐\nceipt of the request, the server calls a dispatch routine to perform the requested service, and\nthen sends back a reply.\n\nThe clntcall(), rpccall(), and rpcbroadcast() routines handle the client side of the proce‐\ndure call.  The remaining routines deal with error handling in the case of errors.\n\nSome of the routines take a CLIENT handle as one of the arguments.  A CLIENT handle can be cre‐\nated by an RPC creation routine such as clntcreate() (see rpcclntcreate(3)).\n\nThese routines are safe for use in multithreaded applications.  CLIENT handles can be shared\nbetween threads, however in this implementation requests by different threads are serialized\n(that is, the first request will receive its results before the second request is sent).\n",
            "subsections": []
        },
        "Routines": {
            "content": "See rpc(3) for the definition of the CLIENT data structure.\n\nclntcall()\nA function macro that calls the remote procedure procnum associated with the client han‐\ndle, clnt, which is obtained with an RPC client creation routine such as clntcreate()\n(see rpcclntcreate(3)).  The inproc argument is the XDR function used to encode the\nprocedure's arguments, and outproc is the XDR function used to decode the procedure's\nresults; in is the address of the procedure's argument(s), and out is the address of\nwhere to place the result(s).  The tout argument is the time allowed for results to be\nreturned, which is overridden by a time-out set explicitly through clntcontrol(), see\nrpcclntcreate(3).  If the remote call succeeds, the status returned is RPCSUCCESS,\notherwise an appropriate status is returned.\n\nclntfreeres()\nA function macro that frees any data allocated by the RPC/XDR system when it decoded the\nresults of an RPC call.  The out argument is the address of the results, and outproc is\nthe XDR routine describing the results.  This routine returns 1 if the results were suc‐\ncessfully freed, and 0 otherwise.\n\nclntgeterr()\nA function macro that copies the error structure out of the client handle to the struc‐\nture at address errp.\n\nclntperrno()\nPrint a message to standard error corresponding to the condition indicated by stat.  A\nnewline is appended.  Normally used after a procedure call fails for a routine for which\na client handle is not needed, for instance rpccall().\n\nclntperror()\nPrint a message to the standard error indicating why an RPC call failed; clnt is the\nhandle used to do the call.  The message is prepended with string s and a colon.  A new‐\nline is appended.  Normally used after a remote procedure call fails for a routine which\nrequires a client handle, for instance clntcall().\n\nclntsperrno()\nTake the same arguments as clntperrno(), but instead of sending a message to the stan‐\ndard error indicating why an RPC call failed, return a pointer to a string which con‐\ntains the message.  The clntsperrno() function is normally used instead of\nclntperrno() when the program does not have a standard error (as a program running as a\nserver quite likely does not), or if the programmer does not want the message to be out‐\nput with printf() (see printf(3)), or if a message format different than that supported\nby clntperrno() is to be used.  Note: unlike clntsperror() and clntspcreateerror()\n(see rpcclntcreate(3)), clntsperrno() does not return pointer to static data so the\nresult will not get overwritten on each call.\n\nclntsperror()\nLike clntperror(), except that (like clntsperrno()) it returns a string instead of\nprinting to standard error.  However, clntsperror() does not append a newline at the\nend of the message.  Warning: returns pointer to a buffer that is overwritten on each\ncall.\n\nrpcbroadcast()\nLike rpccall(), except the call message is broadcast to all the connectionless trans‐\nports specified by nettype.  If nettype is NULL, it defaults to \"netpath\".  Each time it\nreceives a response, this routine calls eachresult(), whose form is: boolt\neachresult(caddrt out, const struct netbuf * addr, const struct netconfig * netconf)\nwhere out is the same as out passed to rpcbroadcast(), except that the remote proce‐\ndure's output is decoded there; addr points to the address of the machine that sent the\nresults, and netconf is the netconfig structure of the transport on which the remote\nserver responded.  If eachresult() returns 0, rpcbroadcast() waits for more replies;\notherwise it returns with appropriate status.  Warning: broadcast file descriptors are\nlimited in size to the maximum transfer size of that transport.  For Ethernet, this\nvalue is 1500 bytes.  The rpcbroadcast() function uses AUTHSYS credentials by default\n(see rpcclntauth(3)).\n\nrpcbroadcastexp()\nLike rpcbroadcast(), except that the initial timeout, inittime and the maximum timeout,\nwaittime are specified in milliseconds.  The inittime argument is the initial time that\nrpcbroadcastexp() waits before resending the request.  After the first resend, the re-\ntransmission interval increases exponentially until it exceeds waittime.\n\nrpccall()\nCall the remote procedure associated with prognum, versnum, and procnum on the machine,\nhost.  The inproc argument is used to encode the procedure's arguments, and outproc is\nused to decode the procedure's results; in is the address of the procedure's argu‐\nment(s), and out is the address of where to place the result(s).  The nettype argument\ncan be any of the values listed on rpc(3).  This routine returns RPCSUCCESS if it suc‐\nceeds, or an appropriate status is returned.  Use the clntperrno() routine to translate\nfailure status into error messages.  Warning: rpccall() uses the first available trans‐\nport belonging to the class nettype, on which it can create a connection.  You do not\nhave control of timeouts or authentication using this routine.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "These functions are part of libtirpc.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "printf(3), rpc(3), rpcclntauth(3), rpcclntcreate(3)\n\nBSD                               May 7, 1993                              BSD",
            "subsections": []
        }
    },
    "summary": "rpcclntcalls, clntcall, clntfreeres, clntgeterr, clntperrno, clntperror, clntsperrno, clntsperror, rpcbroadcast, rpcbroadcastexp, rpccall — library routines for client side calls",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "printf",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/printf/3/json"
        },
        {
            "name": "rpc",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpc/3/json"
        },
        {
            "name": "rpcclntauth",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcclntauth/3/json"
        },
        {
            "name": "rpcclntcreate",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcclntcreate/3/json"
        }
    ]
}