Home > other >  On the select function at the same time to monitor the problem of multiple file descriptors
On the select function at the same time to monitor the problem of multiple file descriptors

Time:10-02

When multiple read file descriptor is added to the collection, such as:
 
FD_SET (fd1, & amp; Readfds);
FD_SET (fd2, & amp; Readfds);
FD_SET (fd3, & amp; Readfds);

At this time to call the select function to monitor the three file descriptors, if there are two or more than two file descriptors can be read at the same time, should be how to deal with the subsequent work?
Can because only deals with one of the descriptor, and to ignore the other?

CodePudding user response:

Cycle detection processing, that is, each can be detected all the three will read again and see if it is readable, so, this is a general practice, you can get a readable collection WINDOWS, circulation processing, then
  • Related