how do I stop SocketServer()?

Diez B. Roggisch deets at nospam.web.de
Wed Aug 27 12:44:46 EDT 2008


Alexandru  Mosoi wrote:

> supposing that I have a server (an instance of SocketServer()) that
> waits for a connection (ie is blocked in accept()) and in another
> thread i want to stop the server, how do I do that?

By setting a timeout on the socket using socket.settimeout, and then
periodically check for an abortion condition in the server thread before
re-accepting connections.

Diez



More information about the Python-list mailing list