[Tutor] Closing BaseHTTPServer...

Python python at venix.com
Sat Jul 16 21:30:49 CEST 2005


This sidesteps the issue of how to fix your threading code.
SocketServer has a ThreadingMixIn class.  You can create a threading
HTTPServer without coding the threading yourself.

(watch for typos - this is NOT from working code)

class ThreadingHTTPD(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
	pass
srvr = ThreadingHTTPD( <address,port tuple>, <request handler class>)
srvr.serve_forever()

Credit for this goes to John Goerzen and his fine book "Foundations of
Python Network Programming"

-- 
Lloyd Kvam
Venix Corp



More information about the Tutor mailing list