Select weirdness
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Apr 23 03:51:52 EDT 2007
En Mon, 23 Apr 2007 04:33:22 -0300, Ron Garret <rNOSPAMon at flownet.com>
escribió:
> I have not been able to find a proxy server that can proxy to unix
> sockets, so I need to write my own. Conceptually its a very simple
> thing: read the first line of an HTTP request, parse it with a regexp to
> extract the sandbox name, connect to the appropriate unix server socket,
> and then bidirectionally pipe bytes back and forth. But it has to do
> this for multiple connections simultaneously, which is why I need select.
No. This is what the *server* should do, not the *handler*. The server
listens on incoming requests, and creates a new handler for each one.
Inside a handler, you don't have to worry about multiple connections.
If you want to process simultaneous connections, inherit your server from
ThreadingMixIn or ForkingMixIn (or use one of the predefined server
classes).
--
Gabriel Genellina
More information about the Python-list
mailing list