quote:
Original post by Anonymous Poster
select() is the canonical way of polling multiple sockets on UNIX. You could conceivably set each socket in non-blocking mode and read it to figure out whether there''s any data, but that would require a trip into the kernel for each socket that COULD have data, which is much slower than using a single call to find out which sockets DO have data, and then only tripping into the kernel for those specific sockets.
A couple of comments...
1. We''re talking about a single UDP socket. A non-blocking recvfrom() call when (in an MMO) you will almost always be receiving data, is not introducing any overhead because you will need to call recvfrom anyways to get the data (that most likely will be there).
2. The BSD standard implementation of select() is horrible, and runs through the entire list of descriptors (files, sockets, pipes, all of them) for every single socket in the FDSET. Take a look at the code sometime, it''s laughable. poll() isn''t really too much better.
quote:
If you don''t think this distinction matters, you''re not ready to tackle an MMO server, btw :-)
Interestingly enough the distinction is irrelevant when considering a single socket on a busy server. As far as being ready for an MMO, well it''s not as big a deal as you might think it is...