Instructs the rpcbind service on a remote host to make a remote procedure call (RPC) on behalf of the caller to a procedure on that host.
Network Services Library (libnsl.a)
#include <rpc/rpc.h>
 enum clnt_stat rpcb_rmtcall(nconf, host, prognum, progver, procnum, in_proc, input, out_proc, output,
 t_out, svcaddr)
const struct netconfig *nconf
const char *host
const rpcprog_t prognum;
const rpcvers_t versnum;
const rpcproc_t procnum;
const xdrproc_t in_proc;
const caddr_t input;
const xdrproc_t out_proc;
const caddr_t output;
const struct timeval t_out;
struct netbuf *svcaddr
The rpcb_rmtcall subroutine is an interface to the rpcbind service. The subroutine instructs the rpcbind service on the remote host to make an RPC call on behalf of the caller to a procedure on that host. The netconfig structure must correspond to a connectionless transport. You can use this subroutine for a ping program because the subroutine performs the lookup and call in one step.
| Item | Description | 
|---|---|
| host | Specifies the host name on which the server resides. | 
| prognum | Specifies the program number of the remote host. | 
| progver | Specifies the version number of the remote host. | 
| procnum | Specifies the procedure number on the remote host. | 
| in_proc | Specifies the eXternal Data Representation (XDR) procedure to encode the input parameters. | 
| out_proc | Specifies the XDR procedure to decode the output results. | 
| output | Specifies the address of output parameters. | 
| t_out | Specifies the timeout value. | 
| input | Specifies the address of input parameters. | 
| nconf | Specifies the protocol associated with the service. | 
| svcaddr | Specifies the address of the remote service when the procedure succeeds. | 
| Item | Description | 
|---|---|
| RPC_SUCCESS | successful | 
| nonzero | unsuccessful | 
| Item | Description | 
|---|---|
| RPC_TIMEDOUT |  
  | 
#include <rpc/rpc.h>
int main()
{
    struct netconfig *nconf;
    rpcprog_t PROGNUM = 0x3fffffffL;
    rpcvers_t PROGVER = 0x1L;
    rpcproc_t PROCNUM = 0x1L;
    struct timeval timeout = {25,0};
    int req , resp;
    enum clnt_stat cs;
    char host[255]; /* Remote host name */
    req = 5 ; /* initialise input parameter to a valid value */
    /* Set the netconfig structure for tcp transport */
    if ((nconf = getnetconfigent("tcp")) ==(struct netconfig *) NULL) {
        printf("getnetconfigent() failed");
        exit(1);
    }
    /* Call the remote procedure using rpcb_rmtcall() */
    cs = rpcb_rmtcall(nconf,host,PROGNUM,PROGVER,PROCNUM,(xdrproc_t)xdr_int,
        (caddr_t)&req, (xdrproc_t)xdr_int, (caddr_t)&resp, timeout, nbuf);
    /* Check for the return status */
    if(cs != RPC_SUCCESS)
    {
        printf("rpcb_rmtcall() failed");
        exit(1);
    }
    return 0;
}