Home > Back-end >  Questions about the used in the select FD_ISSET
Questions about the used in the select FD_ISSET

Time:10-21

I wrote a framework based on the select the socket communication code

Now for the select use FD_ISSET little doubt

I use FD_ISSET twice, in the loop will cause the testing results of the two FD_ISSET different?

 
While (1)
{

For (int I=0; i {
If (FD_ISSET (client_fds [I], & amp; Server_fd_set))
{
//does not handle
}
}

For (int I=0; i {
If (FD_ISSET (client_fds [I], & amp; Server_fd_set))
{
//processing
}
}
}

CodePudding user response:

In theory, will, because the two processing time, the judge result is not read and write at a certain moment, do not represent the next moment cannot read and write, the reverse is also true, some point to judge the result is read/write, do not represent the next moment also can read and write,

CodePudding user response:

FD_ISSET did not change the fd and fdset, the result should be the same
  • Related