determining how much data is on a socket

Z 3 Penguin z3penguin at
Sun Dec 17 00:33:51 CET 2000

is there any way to find out how much data is waiting on a given socket?  my program reads 2 bytes from the socket to know how much more it needs to read.  however, sometimes it reads those two bytes and pauses until the rest of the data comes in.  i would like to know if the bytes are waiting before i read, so that if they are not, my program can continue and try to read it later.  any ideas?

More information about the Python-list mailing list