PHP Socket management

93 views Asked by At

I have been trying PHP Sockets lately. I could use some help understanding a few things.

Once I start a socket and begin listening:

socket_server.php:

socket_create(AF_INET, SOCK_STREAM, 0); 
socket_bind($socket, $host, $port); 
socket_listen($socket, 3);

How do I then :

  • shut down the socket on that port whenever I want to?

So the socket is running via initiating 'socket_server.php' and I decide I would like to shut it down. If I have not added any 'socket_close()' to 'socket_server.php' how do I shut it down?

  • keep track of if the socket listener is still running?

Once I have initiated 'socket_server.php' - how do I monitor that it is still running?

Thank you.

0

There are 0 answers