(beginner) question on threads...
Skip Montanaro
skip at pobox.com
Fri Aug 31 11:28:39 EDT 2001
Fred> Off to a bad start, I made the following simple-minded change :
Fred> in class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler) :
Fred> in def handle(self) :
Fred> the last line : method() # generally self.do_GET()
Fred> becomes : thread.start_new_thread(method, () )
I think you can just create a suitable subclass of SocketServer.TCPServer.
In my XML-RPC server, I did:
class GenericServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
"""generic XML-RPC server class"""
...
Each request to my server is handled in a separate thread.
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list