Another socket/thread question

Ype Kingma ykingma at accessforall.nl
Wed Mar 13 14:24:46 EST 2002


Ken wrote:
> 
> Hey everyone..
> 
> I've got a thread that continously listens to a socket, and reports what it
> receives. Blocking is turned on, and I would like it to stay that way since
> the only thing the thread has to do, is listen to the socket.
> 
> My question is when the socket needs to be closed (program shuts down, or
> that user is being disconnected by the server) is it possible to interupt a
> socket.recv ()?

When you close the socket from another thread or by the server,
the pending socket.recv() should terminate with some error condition.
It's best to test both situations, however.

Have fun,
Ype



More information about the Python-list mailing list