Ping Equivalent For Checking If A Port Is Open

monitoringnetwork-monitoringpinguptime

How do I check if a port is consistently alive? For example, I could use

ping 192.168.1.1 -t > results.txt

This will ping 192.168.1.1 continuously so that I could monitor it.
Is there an equivalent tool or command that I could use for this?

Currently I use telnet but sometimes the host disconnects it. I need a Windows solution.

Best Answer

You could use netcat if there is a Windows version - on Linux I use:

nc -z <host> <port>

This returns 0 if the port is open. Run this in a loop for make it continuous.

If Powershell is available, see https://web.archive.org/web/20111102182913/http://poshcode.org/85 for an example.

Related Topic