serve_forever() and non-blocking connection
quatrelle at gmx.ch
Sat Sep 7 19:09:52 EDT 2002
I have a problem programing a small proxy with non-blocking sockets. I
guess asyncore would be better, but I have no idea how to implement it
and the application is runing now (just too slow).
So I would like to use threads. First here a small example of what I use
for the connection (inside a function):
http_proxy = HTTPServer(configuration.listen, RequestHandler)
Now this serve_forever() process one request at a time.
Ok this is working but too slow. I tried to to use handle_request()
instead of serve_forever() in a while loop and put some
in there. But this looks too dirty and apparently does not help much.
So here my newbee question: what would be the (better) right approach to
be able so serve many connections at the same time? Knowing that each
process can be quite CPU hungry.
Any advice is greatly aprecieted
More information about the Python-list