httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: open persistent client connection from apache 2?
Date Tue, 18 Sep 2001 14:05:47 GMT
On Tuesday 18 September 2001 06:22 am, zethix or something wrote:

This is possible, but not easy.  You will need to write your own MPM,
so that you can detect when there is data on that socket.  Of course,
you could also just modify one of the existing MPMs, but this kind
of logic is unlikely to ever get into the core.

Or, you could hack a module together to do this.  Two ways I can think
of:

1)  In the post_config phase, fork a process that will open a socket, and
listen on it.
2)  In the post_config phase create a thread to open a socket and listen
on it.  (Creating a thread in the parent process would be a bad thing IMO,
so I like option 1 better).

That process/thread will listen on the socket, and when data come in,
it will connect to the server, and make a request.  The data will go back to
your process, and you will forward it back out through that process.

Of course, this has scalability issues, because there is only one request
at a time, but that can be gotten around by forking, the way mod_cgid does,
or by making that process multi-threaded.

Ryan

> Hi,
>
> I'm writing a module for apache 2. What I need is to create a socket from
> the server, then connect it to somewhere and keep the connection open
> while the server is alive. Also, of course, I would like to be able to
> receive data from the socket and then to trigger handling of a request by
> the rest of the server code. Is this possible?
>
> regards zethix

-- 

______________________________________________________________
Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Mime
View raw message