i have a php server with an array of clients which are connected to the server..
is there a way for me to find out for how long each client is connected and if the client passed the timeout time to disconnect it ? does php save somewhere the time the socket were accepted ?
i’m trying to get rid of ghost clients..
i know that i can set the time the socket accepted myself and to loop throw it but my question if there is some kind of socket_get_connection_time() function of something similar ?
One way to handle this is using signals, if you are using a Unix-based platform (I don’t believe this is available on Windows).
First, you need to make sure your PHP build includes the pcntl_* functions. See docs here:
http://php.net/manual/en/book.pcntl.php On many installations, it is not compiled in by default.
You would do something like this: