Monday 1 May 2017

What is the best way to start and stop a socket server

I have an application in PHP that consumes a socket. Let's put as an example a chat application that uses a file called chat-server.php. My question is. How should I start the chat-server.php file. As an operating system service and let it reside in memory forever, even when not in use? Or should I start it only when a chat room is opened and stop the socket when there is no one else? Would this work? But what if by chance a mistake happens and the socket is not stopped. The chat program would try to open one more chat-server.php and over time if these errors are occurring it would overload the server and keeping chat-servers sockets oppened or maybe do not even open.



via Daniel Santos Neto

No comments:

Post a Comment