If you are unable to connect to a particular TCP service, such as a web server, ftp server, or anything else, you may be experiencing a number of both network and service connectivity problems:
- The hostname you typed in cannot be resolved
- The ip address of the server is not reachable due to network connectivity problems
- The server's firewall has rejected your connection
- The service is not running, or is not listening at the specified port
The PING command can help you determine whether you are experiencing 1-2. But it doesnt help you actually determine whether you are having issues with 3-4.
I put together a little tool that can tests TCP connectivity to the specific port on the target machine, something that the PING command cannot do. You can use it to determine whether IIS is listening on a particular ip/port and whether you can get to it – or test connectivity to any arbitrary TCP services (since it will expose DNS, network connectivity, lack of active listening connections), such as SQL Server. Note that the tool doesn’t do any application protocol specific communication (such as making an HTTP request) – it simply establishes a TCP connection and closes it.
This code is distributed under the Microsoft Permissive Use License, meaning you can do with it whatever your please but I bear no responsibility for how you use it.
> PortCheck.exe localhost 80
The tool will report whether it connected successfully, timed out when connecting, or was rejected by firewall / because noone was listening on the port.