Invokes the remote procedure associated with the specified program and version by broadcasting the call message through all connectionless transports of the specified class.
Network Services Library (libnsl.a)
#include <rpc/rpc.h>
enum clnt_stat rpc_broadcast(prognum, versnum, procnum, in_proc, input, out_proc, output, result, 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 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 subroutine. The addr parameter
holds the address of the machine that sent the results. The nconf parameter
specifies the transport that is used by the machine to respond. If
the result subroutine returns a value of 0, the rpc_broadcast 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 | The remote procedure number. |
in_proc | An XDR procedure for encoding the procedure parameters. |
input | The address of the procedure arguments. |
out_proc | An XDR procedure for decoding the procedure results. |
output | The address where the results will be placed. |
result | The subroutine that is invoked when the rpc_broadcast receives a response. |
nettype | Defines a class of transports which can be used for a particular application. |
Item | Description |
---|---|
0 | successful |
an appropriate status | unsuccessful |
You can obtain the status using the clnt_perrno subroutine.
The rpc_broadcast 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 out, 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";
cs = rpc_broadcast(program_number, version_number, procedure_number,
(xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_void,
NULL, eachresult, nettype);
if (cs != RPC_SUCCESS)
{
fprintf(stderr,"\n RPC Call failed\n");
exit(1);
}
return 0;
}