views:

12

answers:

0

Hi all,

I need some advice regarding writing a module for the apache web server. This module needs to create a TCP server which will listen to incoming connection from another application in our system. The server is having its own protocol, and I use plain unix functions (socket, bind, listen so nothing fancy around there) to create the server.

The code for it is written, and works, however I have a problem: if I create the web server in the initialization phase of apache (ie. in the functions which register the hooks) the bind phase of my TCP server fails with code 98 (address already in use??? - however, there is nothing else using that port). If I create the web server when I get a query, everything works nicely. The problem is, that I'm supposed to have up the TCP server before any query comes in since the results of the query depend on data I get from the TCP server...

Have you ever had a situation like this? Did you find a solution to it?

Thanks, fritzone