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                              [EMAIL PROTECTED]
Covalent Technologies                   [EMAIL PROTECTED]
--------------------------------------------------------------

Reply via email to