Returns data for each server connection. Format #include <rpc/rpc.h> void svc_getreqset(fd_set *rdfds);
1 – Arguments
rdfds A pointer to the read file descriptor bit mask modified by the select routine.
2 – Description
The svc_getreqset routine is for servers that implement custom asynchronous event processing or that do not use the svc_run routine. You can only use svc_fdset when the server does not use svc_run. You are unlikely to call this routine directly, because the svc_run routine calls it. However, there are times when you cannot call svc_run. For example, suppose a program services RPC requests and reads or writes to another socket at the same time. The program cannot call svc_run. It must call select and svc_getreqset. The server calls svc_getreqset when a call to the select system call determines that the server has received one or more RPC requests. The svc_getreqset routine reads in data for each server connection, then calls the server program to handle the data. The svc_getreqset routine does not return a value. It finishes executing after all sockets associated with the variable rdfds have been serviced. You can use the global variable svc_fdset with svc_getreqset. The svc_fdset variable is the RPC server's read file descriptor bit mask. To use svc_fdset: 1. Copy the global variable svc_fdset into a temporary variable. 2. Pass the temporary variable to the select routine. The select routine overwrites the variable and returns it. 3. Pass the temporary variable to the svc_getreqset routine.
3 – Example
#define MAXSOCK 10 int readfds[ MAXSOCK+1], /* sockets to select from*/ i, j; for(i = 0, j = 0; i << MAXSOCK; i++) if((svc_fdset[i].sockname != 0) && (svc_ fdset[i].sockname != -1)) readfds[j++] = svc_fdset[i].sockname; readfds[j] = 0; /* list of sockets ends with a zero */ switch(select(0, readfds, 0, 0, 0)) { case -1: /* an error happened */ case 0: /* time out */ break; default: /* 1 or more sockets ready for reading */ errno = 0; svc_getreqset(readfds); if( errno == ENETDOWN || errno == ENOTCONN) sys$exit( SS$_THIRDPARTY); }
4 – Return Values
None