How to stop a SocketServer?

Irmen de Jong irmen at NOSPAMREMOVETHISxs4all.nl
Sat Jun 22 06:58:18 EDT 2002


Paul Rubin wrote:


> Then I instantiate the server and run the serve_forever() method.

Don't use the serve_forever() method.
Use handle_request() which handles a single request.
You can now build your own request loop that
exits cleanly, for instance when a 'stopLoop' flag
has been set.

One problem still with this: the loop only exits after
a request has been processed (handle_request will still block).

Irmen




More information about the Python-list mailing list