How to kill a SocketServer?

Diez B. Roggisch deetsNOSPAM at web.de
Mon Apr 12 11:39:18 EDT 2004


> The problem is, that I found no way to interrupt the blocking call to
> self.rfile.readline(). Is there a way to do that?

>From the SocketServerDocs:

---------------
serve_forever()

 Handle an infinite number of requests. This simply calls handle_request()
inside an infinite loop. 

---------------

So simply call handle_request yourself, like this:

while self.run_me:
  s.server_forever()


run_me is a variable that can be set to false in stop_server

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list