Select weirdness
Ron Garret
rNOSPAMon at flownet.com
Mon Apr 23 12:46:59 EDT 2007
In article <op.tq774q1vx6zn5v at furufufa-ec0e13.cpe.telecentro.com.ar>,
"Gabriel Genellina" <gagsl-py2 at yahoo.com.ar> wrote:
> 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).
Ah, good point.
But that still leaves the problem of keep-alive connections. I still
need to be able to forward data in both directions without knowing ahead
of time when it will arrive.
(I think I can solve the problem by using send and recv directly BTW.)
rg
More information about the Python-list
mailing list