A simple tool for checking TCP connectivity

This is a short one.

One of the most common things I do is to simply check if something works. The quicker I can find out if it works or not, the better. What this little program does can be easily accomplished with various other tools, such as telnet, test-netconnection (a powershell cmdlet), nmap, psping and the list goes on.

Yet, this little tool has become a bread and butter tool for me, the reason mostly being simplicity. Telnet is no longer installed by default on windows servers. test-netconnection only works in powershell and not in a cmd terminal. Nmap and psping both require you to know the syntax, as simple as they may be.

For some reason, I’ve stuck with using portcheck.exe

The tool is extremely stripped down, there are no flags, no bells and whistles, it will check TCP connectivity to a host on a port, and it will do nothing else. It’s this simplicity that’s made it useful to me personally, so I’ve decided to share it.


The syntax is extremely simple:

> portcheck.exe example.org 80

Successfully connected to server.

> portcheck.exe example.org 21

The connection attempt timed out.

I always keep a handy c:\tools folder on my windows machines, and I add it to the path of the machine, so I can tab-complete and call the programs in there from wherever I am. Another option is sticking the portcheck.exe file in a directory that is included in the path by default, such as c:\windows. I highly recommend the tools approach though. Here’s an older article on how to add stuff to your path quickly.

The source code for the portcheck tool is available on github. Break it in any way you see fit! I hope this tool helps someone.