Sockets and time-outs

Ulf Engstrøm ulf.engstrom at b2b-link.com
Mon Aug 14 10:26:58 EDT 2000


I'm using the socket module for a program, but there's one thing that I want
to improve on it.
The client side of this sends data to the server and always get a reply
back, but sometimes the server sends something that wasn't requested of the
reply comes in two sends. Thus I need to read the socket sometimes to see if
there's something waiting. Using recv() is great for getting a reply I know
is there, but when using it and there's no message there it takes an awfully
long time to time out and waiting for this time-out blocks the sending on
the same socket. Is there any way to set a shorter time-out (basically just
check for 2 secs or so) or is there an other function for this?
Regards
Ulf





More information about the Python-list mailing list