httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Farber <>
Subject HTTP Streaming with Apache 1
Date Mon, 01 Mar 2010 08:57:21 GMT

I have a game, a daemon listening at port 8080 for TCP clients.
The clients send auth. details with each their message and
I keep the state, so the TCP-connection can be interrupted
and then reconnected and the game will still continue.

To support players behind corporate firewalls :-) I've written a simple
Apache module, which will listen for client requests at the port 80,
then read that POST request in, then connect to port 8080 and
forward that data. Then it will stay connected to both ports and
forward data from the game daemon to the web client:

I want it to stay connected and "stream HTTP data" back, so that
I can update the web clients instantly, when something changes.

Perfect solution would be to poll() at the both sockets (80 and 8080)
and forward the data in both directions. But unfortunately this
isn't possible with Apache 1 (would it work with Apache 2?
Can I get ahold of the client socket there and can I poll() it?)

So I try the other trick: when the web client needs to send
a new asynchronous message to the game daemon,
I cancel the previous connection (unfortunately the Apache
module doesn't notice that, because it is blocking while reading
from the port 8080 socket) and also in the game daemon
I take the notice, that a new message has arrived from the same
user and close the port 8080 socket to the old Apache module.

Unfortunately this works only few times and then I hit the max.
children limitation of Apache (I've set it to 10 at my debug server)
and Apache refuses to accept further connections.

I'm using Apache 1.3.x of OpenBSD 4.5 and the source code
of my Apache module is at

Does anybody have any good comments?

Thank you

PS: And my (Russian card) game is at  :-)

View raw message