select TCP UDP

Check if any sockets are ready for available read or write operations or error conditions. See function NetSock_Sel() for more information.

Files

net_bsd.h/net_bsd.c

Prototype

int  select (        int       desc_nbr_max,
             struct  fd_set   *p_desc_rd,
             struct  fd_set   *p_desc_wr,
             struct  fd_set   *p_desc_err,
             struct  timeval  *p_timeout);

Arguments

desc_nbr_max

Maximum number of file descriptors in the file descriptor sets.

p_desc_rd

Pointer to a set of file descriptors to:

    1. Check for available read operations.
    2. Return: 
        1. The actual file descriptors ready for available read operations if no error(s).
        2. The initial, non-modified set of file descriptors on any error(s).
        3. Return a null-valued (i.e. zero-cleared) descriptor set if any timeout expires.
p_desc_wr

Pointer to a set of file descriptors to:

    1. Check for available write operations.
    2. Return:
        1. The actual file descriptors ready for available write operations if no error(s).
        2. The initial, non-modified set of file descriptors on any error(s).
        3. A null-valued (i.e. zero-cleared) descriptor set if any timeout expires.
p_desc_err

Pointer to a set of file descriptors to:

    1. Check for any errors and/or exceptions.
    2. Return:
        1. The actual file descriptors flagged with an error and/or exception if no non-descriptor-related error(s).
        2. The initial, non-modified set of file descriptors, on any error(s).
        3. A null-valued (i.e. zero-cleared) descriptor set if any timeout expires.
p_timeout

Pointer to a timeout.

Returned Value

The number of file descriptors with available resources and/or operations if any.

0, on timeout.

-1, otherwise.