Invokes the remote procedure associated with specified program and version by broadcasting the call message through all connectionless transports of the specified class with initial wait time and the maximum wait-time constraints.
Network Services Library (libnsl.a)
#include <rpc/rpc.h>
enum clnt_stat rpc_broadcast_exp(prognum, versnum, procnum, in_proc, input, out_proc, output,
result, itime, wtime, nettype)
const rpcprog_t prognum;
const rpcvers_t versnum;
const rpcproc_t procnum;
const xdrproc_t in_proc;
caddr_t input;
const xdrproc_t out_proc;
caddr_t output;
const resultproc_t result;
const int itime;
const int wtime;
const char *nettype;
bool_t result(caddr_t output, const struct netbuf *addr, const struct netconfig *nconf);
The output parameter
of the subroutine is the same as that of the rpc_broadcast_exp subroutine.
The addr parameter holds the address of the machine that sent
the results. The nconf parameter specifies the transport used
by the machine to respond. You can specify the initial time before
the request is resent in milliseconds. Similarly, after the request
is resent for the first time, the retransmission interval increases
exponentially until it exceeds the maximum value that you can also
specify in milliseconds. If the result subroutine returns a
value of 0, the rpc_broadcast_exp subroutine waits for more
replies. Otherwise, the subroutine returns with an appropriate status.Item | Description |
---|---|
prognum | Specifies the program number of the remote program. |
versnum | Specifies the version number of the remote program. |
procnum | Specifies the remote procedure number. |
in_proc | Specifies the XDR procedure for encoding the procedure parameters. |
input | Specifies the address of the procedure arguments. |
out_proc | Specifies the XDR procedure for decoding the procedure results. |
output | Specifies the address where the results will be placed. |
result | Specifies the subroutine that is invoked when the rpc_broadcast_exp receives a response. |
itime | Specifies the initial timeout before the request is resent. |
wtime | Specifies the maximum timeout. |
nettype | Defines a class of transports which can be used for a particular application. |
The rpc_broadcast_exp subroutine returns failure when one or more of the following codes are true.
Item | Description |
---|---|
RPC_UNKNOWNPROTO |
|
RPC_TIMEDOUT |
|
RPC_PROGVERSMISMATCH | The specified version is not registered at the server. |
RPC_FAILED | An unspecified error occurred. The procedure specified by the in_proc or out_proc parameter might not be valid. |
RPC_CANTDECODEARGS | The arguments or results are not valid. |
RPC_SYSTEMERROR | All of the process memory is exhausted (heap). |
#include <rpc/rpc.h>
bool_t result(caddr_t output, const struct netbuf *addr, const struct netconfig *nconf)
{
/* result() subroutine code */
}
int main()
{
rpcprog_t program_number = 0x3fffffffL;
rpcvers_t version_number = 0x1L;
rpcproc_t procedure_number = 0x1L;
enum clnt_stat cs ;
char *nettype = "visible";
const int itime = 5 ;
const int wtime = 25 ;
cs = rpc_broadcast_exp( program_number, version_number, procedure_number,
(xdrproc_t)xdr_void, NULL,(xdrproc_t)xdr_void, NULL,
result, itime, wtime, nettype);
if (cs != RPC_SUCCESS)
{
fprintf(stderr,"\n RPC Call failed\n");
exit(1);
}
return 0;
}