After calling the select() function, which looks like this:

 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); 

we can call the FD_ISSET() macro for the descriptor to check the flag (is our descriptor ready)

 void FD_ISSET(int fd, fd_set *set); 

Please tell me after calling the macro FD_ISSET() for a descriptor that has the flag raised, does this flag go down after the call?

    2 answers 2

    The following is written in mana:

     Four macros are provided to manipulate the sets. FD_ZERO() clears a set. FD_SET() and FD_CLR() respectively add and remove a given file descriptor from a set. FD_ISSET() tests to see if a file descriptor is part of the set; 

    I understand this quite uniquely: the FD_CLR () macro clears the bit, and FD_ISSET () only checks this bit.

      Why use select ()? I recommend to look towards poll () here . And for your question, look here .