Close a socket externally

Michael Fuhr mfuhr at fuhr.org
Fri Oct 1 19:20:44 EDT 2004


"drs" <drs at remove-to-send-mail-ecpsoftware.com> writes:

> I have a program which opens a socket server in a thread.  I need for the
> server to listen on the socket for a certain amount of time (say, ten
> seconds or so) and then close it, and am wondering if there is a good way to
> close the socket other than sending it a message from another thread to
> close itself.  That is, I am looking for a way to forcably kill a socket
> from a second thread, not to send it a message to kill itself.

Why the requirement to close the socket from another thread?  Why
can't the thread that created the socket time out and close the
socket itself?

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



More information about the Python-list mailing list