SocketServer question

Nagy László nagylzs at freemail.hu
Sat Feb 15 10:39:59 EST 2003


This is from the Python Library Reference, about SocketServer:

 >request_queue_size: The size of the request queue. If it takes a long 
time to process a single request, any requests that arrive while the 
server is busy are placed into a >queue, up to request_queue_size 
requests. Once the queue is full, further requests from clients will get 
a ``Connection denied'' error. The default value is usually 5, >but this 
can be overridden by subclasses.

I do not fully understand what does it mean. Is it for synchronous 
processing only?
I'm using ThreadingMixIn. I think that every client has a separate 
handler thread.
How can I limit the number of clients in a multi-threaded server? I 
could not find an
option for this. Did I missed something in the documentation?

Another important question: when I call server.handle_request() it will 
block until
an incoming connection arrives. Meanwhile there can be other handler 
threads running.
This way I'm unable to stop the server because the main thread is 
blocked. Is there
a way to give a timeout for handle_request so I can preiodically check 
if it is time
to stop the server? If not, how can I stop the server gracefully?
(I would like to stop or restart the server using a client connected to it.)

Regards,

  Laci 1.0







More information about the Python-list mailing list