Socket Programming Question
Ng Pheng Siong
ngps at madcap.
Fri Apr 7 17:55:51 CEST 2000
According to Ray Van Dolson <rayvd at nospam.firetail.org>:
> I'm trying to write a simple chat server w/ Python sockets that supports
> multiple connections and am having a little trouble...
Try using SocketServer.ThreadingTCPServer.
Here's an excerpt of the docu:
The SocketServer module simplifies the task of writing network
There are four basic server classes: ...
These four classes process requests synchronously; each request
must be completed before the next request can be started. This
isn't suitable if each request takes a long time to complete,
because it requires a lot of computation, or because it returns
a lot of data which the client is slow to process.
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.
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps
More information about the Python-list