I have a PHP script that acts as a chat server (websocket) that I have on a certain system. I realize that sometimes this service unexpectedly stops running. It runs through the nohup
command.
I'm using Linux.
I just realize that my websocket script stops working when I see the browser error:
WebSocket connection to 'wss: // myserver: 9001 / chat' failed: Error during WebSocket handshake: net :: ERR_CONNECTION_RESET
Well, I would like to know if my websocket server script actually stopped running because I do not know if the browser error always means that my server "crashed."
So how can I detect if a port is in use or not?
What command in Linux
can I use to know if a port is open or not?