Question

I need to verify the communication between my PC and a server. The verification would be done like this:

I would ping a server port to know if the firewall allows me to communicate with it, but this port has a service running over it, so, I don't want to use it, I just want to verify the communication with the server using that port.

Was it helpful?

Solution

Ping does not allow you to specify a port, it only tells you if the server is responding or not, to check if a port allows communication, you can establish a TCP connection and close it after it succeed.

OTHER TIPS

You can't specify a port number for a ping command, ping uses ICMP protocol (IP protocol number 1) which does not have a concept of ports to start with. Moreover, pinging you server will not tell you if the service in question is available or not.

For instance, a firewall between you and the sever can block any TCP connection yet allow pinging (you'll get false positive in this case) or vice versa (you'll get false negative in this case).

That's why many application protocols implement some king of "check health command" which you can use to check if the service (rather than a server) is available or not.

I suggest you try to connect to the service and if connection fails then you can safely assume your service is not available.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top