Stopping SocketServer on Python 2.5

Falcolas garrickp at
Wed Mar 11 18:57:28 CET 2009

On Mar 10, 7:19 pm, David George <d... at> wrote:
> So, my question is, is there any way to stop a SocketServer that's been
> told to server forever in python 2.5?

serve_forever, in python 2.5, is simply coded as:

while 1:

So, instead of calling serve_forever, call handle_request in your own
loop with a shutdown flag. Assuming, of course, that you aren't using
the Forking server, in which case things get more interesting.


More information about the Python-list mailing list