Purpose
Sends back the results of a remote procedure call.
Library
C Library (libc.a)
Syntax
#include <rpc/rpc.h>
svc_sendreply ( xprt, outproc, out)
SVCXPRT *xprt;
xdrproc_t outproc;
char *out;
Description
The svc_sendreply subroutine sends back the results of a remote procedure call. This subroutine is called by a Remote Procedure Call (RPC) service dispatch subroutine.
Parameters
Item | Description |
---|---|
xprt | Points to the RPC service transport handle of the caller. |
outproc | Specifies the eXternal Data Representation (XDR) routine that encodes the results. |
out | Points to the address where results are placed. |
Return Values
Upon successful completion, this subroutine returns a value of 1. If unsuccessful, it returns a value of 0.
Purpose
Sends back the results of a remote procedure call.
Library
Network Services Library (libnsl.a)
Syntax
#include <rpc/rpc.h>
bool_t svc_sendreply(xprt, oproc, output)
const SVCXPRT *xprt;
const xdrproc_t oproc;
caddr_t output;
Description
The svc_sendreply subroutine sends back the results of a remote procedure call (RPC). This subroutine is called by an RPC service dispatch subroutine. This subroutine encodes the result from a service procedure into the eXternal Data Representation (XDR) format with a specified XDR procedure, and then sends the procedure back to a client.
Parameters
Item | Description |
---|---|
xprt | Points to the RPC service transport handle of the caller. |
oproc | Specifies the eXternal Data Representation (XDR) routine that encodes the results. |
output | Points to the address where results are placed. |
Return Values
Item | Description |
---|---|
TRUE | successful |
FALSE | unsuccessful |
Examples
#include <rpc/rpc.h>
#include <stdlib.h>
#define PROG 0x3fffffffL
#define VERS 0x1L
static void sample_dispatch();
main()
{
char *nettype;
int no_of_handles;
nettype = "tcp";
/* Create RPC service handle and register with RPCBIND service */
if((no_of_handles = svc_create(sample_dispatch, PROG, VERS,nettype)) == 0)
{
fprintf(stdout, " Error in svc_create ");
exit(EXIT_FAILURE);
}
svc_run();
return 0;
}
/* following is the sample dispatch routine*/
static void sample_dispatch(struct svc_req *request, SVCXPRT *xprt)
{
int result;
/* Some code to call appropriate service procedure.
* Procedure will return its result.
*/
/* Send the result back to client */
if(!svc_sendreply(xprt,(xdrproc_t)xdr_int,(caddr_t)&result))
{
fprintf(stdout, " Error in svc_create ");
svcerr_systemerr(transp);
}
}