Hello.
I'm writing a server class in PHP and so far it is working. The is one I would like to implement but I'm not sure how to do it.
What I want to do is fork the process on every incoming connection. This way each connection to the server will spawn a separate process to complete the client's request.
Would I need to accept the connection (socket_accept()) and then fork or is there another way? My assumption would be that on accepting the connection I would have wait for that connection to finish before being able to continue (making forking after accepting a connection useless).
Am I incorrect on this assumption?
TIA
I'm writing a server class in PHP and so far it is working. The is one I would like to implement but I'm not sure how to do it.
What I want to do is fork the process on every incoming connection. This way each connection to the server will spawn a separate process to complete the client's request.
Would I need to accept the connection (socket_accept()) and then fork or is there another way? My assumption would be that on accepting the connection I would have wait for that connection to finish before being able to continue (making forking after accepting a connection useless).
Am I incorrect on this assumption?
TIA