How to kill a SocketServer?
guido@python.org
gvanrossum at gmail.com
Mon May 2 11:04:40 EDT 2005
[Skip Montanaro]
> > def serve_forever(self):
> > while self.serving:
> > r,w,e = select.select([self.socket], [], [],
self.pause)
> > if r:
> > self.handle_request()
> >
> > and set self.pause to something short-ish. The select call times
out and
> > the server exits.
[Paul Rubin]
> Ah, good point. Something like this should probably be added to
> SocketServer.py (optional timeout parameter to serve_forever), or at
> least the trick should be mentioned in the docs.
I like this idea, and perhaps you all could come up with some more
useful APIs in this area; I know that I often struggle a bit with
getting these servers to stop.
(I also like the idea of having the worker thread mixin part of the
standard library -- it seems generally useful.)
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-list
mailing list