Author phr
Date 2005-05-02.03:04:36
SpamBayes Score
Marked as misclassified
First of all the daemon_threads property on socket
servers should be added as an optional arg to the
server constructor, so you can say:
     TCPServer(..., daemon_threads=True).serve_forever()

instead of

    temp = TCPServer(...)

Secondly there should be a way to STOP the server, once
you've started serving forever!  A request handler
should be able to say


This would work by setting a flag in the server object.
 The serve_forever loop would use select with a timeout
(default 0.5 sec, also settable as an optional arg to
the server constructor) or alternatively set a timeout
on the socket object.  So it would block listening for
new connections, but every 0.5 sec it would check the
stop_serving flag and break out of the loop if the flag
was set.

This method was suggested by Skip Montanaro in a clpy
thread about how to stop SocketServer and it's useful
enough that I think it should be part of the standard
impl.  I can make a patch if it's not obvious how to do it.
Date User Action Args
2007-08-23 16:10:58adminlinkissue1193577 messages
2007-08-23 16:10:58admincreate