[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
[Skip Montanaro]
I stumbled on a somewhat cleaner way to do this using socket timeouts:
class Server(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
pause = 0.25
allow_reuse_address = True
def __init__(self, server_address, RequestHandlerClass):
Let's say you have a SocketServer with the threading mix-in and you
run serve_forever on it. How can you shut it down, or rather, how can
it even shut itself down? Even if you use a handle_request loop
instead of serve_forever, it still seems difficult:
class myserver(ThreadingMixIn,
Paul Rubin wrote:
Let's say you have a SocketServer with the threading mix-in and you
run serve_forever on it. How can you shut it down, or rather, how can
it even shut itself down?
I looked at CherryPy's server because I know it uses Python's
BaseHTTPServer which is derived from
Paul Let's say you have a SocketServer with the threading mix-in and
Paul you run serve_forever on it. How can you shut it down, or rather,
Paul how can it even shut itself down? Even if you use a
Paul handle_request loop instead of serve_forever, it still seems
Paul
Skip Montanaro [EMAIL PROTECTED] writes:
I use precisely that scheme with (I think *) no problem. The only maybe
significant difference I see is that I subclass ThreadingMixin so that it
creates daemon threads: ...
According to the docs, you don't need the subclass, you can just set the
I use precisely that scheme with (I think *) no problem. The only
maybe significant difference I see is that I subclass ThreadingMixin
so that it creates daemon threads: ...
Paul According to the docs, you don't need the subclass, you can just
Paul set the daemon_threads
Andrew Dalke [EMAIL PROTECTED] writes:
which means it went a different route. Looks like a
request comes in and is put to a work queue. Clients get
from it. There's a special work queue item to tell
the threads to stop.
Well, ok, so the worker threads stop. How do you get the listener