Purpose
Waits for a Remote Procedure Call service request to arrive.
Library
C Library (libc.a)
Syntax
#include <rpc/rpc.h>
void svc_run (void);
Description
The svc_run subroutine waits for a Remote Procedure Call (RPC) service request to arrive. When a request arrives, the svc_run subroutine calls the appropriate service procedure with the svc_getreqset subroutine. This procedure is usually waiting for a select subroutine to return.
Restrictions
In AIX® 5.2, the maximum number of open file descriptors that an RPC server can use has been set to 32767 so that compatibility can be maintained with RPC-server applications built on earlier releases of AIX.
Purpose
Waits for a Remote Procedure Call service request to arrive.
Library
Network Services Library (libnsl.a)
Syntax
#include <rpc/rpc.h>
void svc_run (void);
Description
The svc_run subroutine waits for a remote procedure call (RPC) service request to arrive and never returns. When a server is configured in single-threaded mode and if a request arrives, the svc_run subroutine calls the appropriate dispatch subroutine. In the Automatic-MT or User-MT mode, this subroutine must be called exactly once. In the Automatic-MT mode, a new thread is created for each new RPC request. In the User-MT mode, the svc_run subroutine does not create threads, and you must create threads to serve RPC requests.
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)
{
/* dispatch routine code */
}