I am writing an application in Python that involves socket programming. I have understood that it's better to use the non-blocking sockets, and thus write an event-driven server. I am not sure as to why and how I should prefer one of these two methods that I want to use: select() and poll() for checking activity in any of the sockets. Could anyone help me out if there's anything in either of these methods that makes it a better choice that the other?
I mean, why would I choose one over the other?
Note that select with a timeout of 0 is basically the same as a poll but the biggest problem for cross system programming is that the support for both select and poll is mixed and inconsistent - personally I tend to opt for a blocking listener in a separate thread that once a complete frame, message, etc., has been received raises an event with the data attached - this seems to work well cross systems.
How can I choose between select.select() and select.poll() methods in the select module in Python?