sockets - recv with time out

sam westernsam at hotmail.com
Thu Jan 10 07:35:31 EST 2002


Hi

This may be more of a "sockets" question than a Python question but
here goes.

I'm writing a Socket Server for an existing sockets client. Once a
connection is opened up the client send me some data, and I reply. The
client may then send more data (on the same connection) or may not. It
is my responisbility to close the connection when the conversation is
finished. At present I listen ad infinitum for more data, and my
handler thread is blocked. I know generally this should be handled
better, but seeing as am working with what I'm given is there a way I
can do a recv with a timeout (to throw an exception, when the timeout
is reached)? Is this something that can be achieved with non-blocking
sockets and if so how?

Any help gratefully received,

Sam



More information about the Python-list mailing list