Another socket/thread question

Aahz aahzpy at panix.com
Wed Mar 13 13:55:32 EST 2002


In article <a6o69c$ntq$1 at horsefly.nf.net>, Ken <khirmint at hotmail.com> wrote:
>
>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 ()?
>
>If not, whats the easiest way to cut processor time from looping endlessly
>with blocking turned off?

http://www.timo-tasi.org/python/timeoutsocket.py
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

The way to build large Python applications is to componentize and
loosely-couple the hell out of everything.



More information about the Python-list mailing list