Data available on socket?

Jan Danielsson jan.danielsson at gmail.com
Fri Jul 22 18:35:03 CEST 2005


Hello all,

   How do I find out if a blocking socket has data available [for
reading] on it?

I assume I could do something like this:

tmp = self.read(1, socket.MSG_PEEK)
if len(tmp) > 0:
   # Data available

   But is there a better way? A call which specifically checks if data
is available?



More information about the Python-list mailing list