Liam Clarke wrote: > Hi all, > > About to embark on my first foray into threading, and rather unsure of > initial approach. I have a basic UDPServer from SocketServer running > using serve_forever(). I'd like to stick this in a thread where it can > endlessly loop waiting for incoming packets, and pushing the received > data into a list where it can be retrieved and operated on by another > thread, until such time as the controlling app terminates it.
Threaded servers are supported by the standard library. Instead of using UDPServer use this class: class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass Then your request handler will be called in a separate thread. You don't need to queue the requests yourself, the server will create the thread and dispatch to it when a request is received. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor