How does fd set work




















Create an FdSet from a list of file descriptors. File descriptors not in range see above are silently ignored. Insert multiple file descriptors. This is more efficient than multiple insert s only a single copy of the set is made.

Test for membership. Recall that POSIX allows undefined behavior if the file descriptor is not valid it does, however, seem to work fine on Linux. Though there are some drawbacks which users pointed out, this how-to helped me a lot.

To do that, you need to use threads or processes. What is your argument exactly? This tutorial is about handling multiple clients, using select function, which it does and it is correct. I can multi clients connect but when I send data from client 1 only client 1 receive response from server. How to server response to all client connected?

I get the success on connect message multiple times from different telnet sessions — however I do not get anything echoed back to telnet client. However there could be sockets with higher id still available.

This is exactly what I was looking for. Your email address will not be published. This version should be used. Improve this question. Maik Klein Maik Klein Add a comment. Active Oldest Votes. Improve this answer. Yu Hao Yu Hao k 42 42 gold badges silver badges bronze badges. So you need the number of bits equal to the number of file descriptors. Hence the math that is taking place above. Sign up or log in Sign up using Google. Sign up using Facebook.



0コメント

  • 1000 / 1000