I've been trying to implement a web server gateway (for fun and educational purposes) and I have some questions about the core architecture behind FastCGI/SCGI with respect to the pre-fork model.
How do FastCGI/SCGI implementations handle communication in pre-fork scenarios? AFAIK, the gateway only has one socket to connect to the FastCGI server. Normally, there is a parent process that accepts connections from the gateway and hands off the work to one of the pre-forked workers.
Since the connections are established after the children are forked, how are you supposed to have the children use these sockets to communicate with the gateway?
I hope I understood the question.
The server socket should be created by the parent process; when it forks, children inherit that socket making it a shared resource. Then, I suppose, each child tries to accept() connections concurrently.