Handles remote procedure call (RPC) requests on an RPC file descriptor asynchronously.
Network Services Library (libnsl.a)
#include <rpc/rpc.h>
 void  svc_getreq_poll(poll_fd, retval)
struct pollfd *poll_fd;
int retval;
This subroutine handles RPC requests on an RPC file descriptor asynchronously (when the svc_run subroutine is not used). Call the subroutine after calling the poll subroutine, which determines that RPC service requests have arrived in RPC file descriptors.
| Item | Description | 
|---|---|
| poll_fd | Represents the array of the pollfd structures on which the polling operation is done. | 
| retval | Represents the value returned by the poll subroutine. | 
#include <stdlib.h>
#include <rpc/rpc.h>
#include <poll.h>
main()
{
    int no_of_fds;
    int i;
    struct pollfd pollfd_set[1024];
    /* Register RPC Service */
           
    /* serve client's requests asynchronously */
    while(1)
    {
        /* initialize the pollfd_set array and 
         get no of file descriptors in "no_of_fds"*/
        /* Keep polling on file descriptors */ 
        switch (i = poll(pollfd_set, no_of_fds, -1))
        {
            case -1:
            case  0:
            continue;
            default:   
            /* Handle RPC request on each file descriptor */
            svc_getreq_poll(pollfd_set, i);
        }
    }
}