Socket sample?

Daniel Orner cs993442 at cs.yorku.ca
Fri May 21 09:58:37 EDT 2004


	Ah, I see! I didn't understand what those classes were doing. Thanks 
very much!

--Daniel

> The SocketServer docs say:
> "The solution is to create a separate process or thread to handle each 
> request; the ForkingMixIn and ThreadingMixIn mix-in classes can be used 
> to support asynchronous behaviour. "
> 
> And if you look in SocketServer.py (from python 2.3.3) you'll see at 
> line 479:
> 
> class ForkingUDPServer(ForkingMixIn, UDPServer): pass
> class ForkingTCPServer(ForkingMixIn, TCPServer): pass
> 
> class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
> class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass
> 
> 
> So it already defines 4 specialized server classes for you to use :-)
> Threading, or forking, whatever suits you best.
> If you want a TCP server that uses a new thread for each request,
> just use SocketServer.ThreadingTCPServer instead of
> SocketServer.TCPServer and you're done!
> 
> --Irmen





More information about the Python-list mailing list