| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

sock_select

#include "sflsock.h"
int
sock_select (int nfds, fd_set *readfds, fd_set *writefds,
             fd_set *errorfds, struct timeval *timeout)

Synopsis

Performs the standard select() call. Use this in preference to select(), as some systems may not be 100% compatible with BSD sockets, Uses the same arguments as the select() call, and gives the same return codes. If sockets are not supported, always returns 0.

Source Code - (sflsock.c)

{
#if (defined (DOES_SOCKETS))
    int
        rc = 0;                         /*  Return code from select()        */
    ASSERT (timeout);

#   if (defined (__UTYPE_BEOS))
    /*  BeOS only supports the readfds argument                              */
    rc = select (nfds, FD_SETTYPE readfds, NULL, NULL, timeout);
    if (rc == -1)
        coprintf ("Error after select(): %s", strerror (errno));
    return (rc);

#   elif (defined (WIN32))
    /*  Windows occasionally aborts during the select call...                */
    __try {
        rc = select (nfds, FD_SETTYPE readfds, FD_SETTYPE writefds,
                           FD_SETTYPE errorfds, timeout);
    }
    __except (1) {
        coprintf ("select() aborted - arguments: %d, %p, %p, %p, %p",
                     nfds, FD_SETTYPE readfds, FD_SETTYPE writefds,
                           FD_SETTYPE errorfds, timeout);
    }
    return (rc);

#   else
    rc = select (nfds, FD_SETTYPE readfds, FD_SETTYPE writefds,
                       FD_SETTYPE errorfds, timeout);
    return (rc);
#   endif
#else
    return (0);
#endif
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation