5
I have a PHP script that acts as a chat server (websocket) that I have on a given system. I realize that sometimes unexpectedly this service stops running. It runs through the command nohup
.
I am using Linux.
I only realize that my websocket script stops working when I see browser error:
Websocket Connection to 'wss://myserver:9001/chat' failed: Error During Websocket Handshake: net::ERR_CONNECTION_RESET
Well, I would like to know how to detect if my websocket server script actually stopped running, because I don’t know if the browser error always means that my server "crashed".
So how can I detect whether a particular port is in use or not?
What command on Linux
can use to know if a door is open or not?
That question interests me too, for the Opensuse.
– Guilherme Lautert
although it is out of context follow nmap -St -The localhost
– Otto
You want to detect inside a script in some specific language or you want to use the linux terminal for such detection?
– Marco Aurélio Deleu
@Marcoauréliodeleu want to use the Terminal. Because then I would know if the script really stopped running or not. The browser may have other problems that count as error.
– Wallace Maxters
@Otto out of context? Linux is the operating system I use on my server. I think talking about the server or the OS it uses here is not out of context.
– Wallace Maxters
@Wallacemaxters but effectively would not be about programming, I may be wrong but it is out of context yes
– Otto
Anyway, @Otto already answered the question. I just have to add that if you want to test (from a point outside the server) if the port is available in TCP, you can use
telnet meudominio.com 443
(where 443 is your door number).– Marco Aurélio Deleu
Your question seems to be outside our scope. But fortunately the network Stack Exchange has the website Unix & Linux which is a Q&A aimed at users of Unix like systems. If you prefer you can forward your question to this community, remembering that it is a community independent of ours that therefore has its own rules is managed in English.
– Augusto Vasques