Writing Multithreaded Client-Server in Python.

Paul Rubin http
Tue Aug 30 04:37:49 EDT 2005


google at phaedro.com writes:
> What it does do, is handle each request (from the same client too) in a
> new separate thread. Convenient if your processing intensive handle may
> otherwise slow down the main server process becoming less responsive to
> other requests.
> What it doesn't do (and what Sidd seems to search as is suggested by
> his 'select()' remark) is handle each client in a separate thread.

I don't know what you mean by that.  It launches a new thread for each
client connection.  The connection is two-way and can last as long as
desired.  If you're imagining something like a web server handling
http requests, using http 1.1 keepalive, you could handle any number
of requests in that connection.

> If you want to apply SocketServer such that each client corresponds to
> one thread that handles its' requests (and maintains its state), don't
> use ThreadingMixIn - only the thread-selection will be executed in a
> separate thread.

What do you mean by "each client"?  If a client connects, does some
stuff, disconnects, and later reconnects, how do you know that it's
the same client that's come back?



More information about the Python-list mailing list