SPORT - Simple PORt Tester

Over the past week at work I have been involved in trying to prove conectivity between some servers in a complicated network environment with multiple sites, multiple firewalls and, multiple OS's; add to this the fact that the apps with issues are from a third party with complicated logs and start up mechanisms. A complete nightmare, my logical mind decided to go back to the very basics, start with plain connectivty outside the third party app back to an OS level. Having Java at my disposal I decided to build a cross platform port tester that could be used to test this basic connectivity.

I looked at how I might achieve this with the least amount of software and external apps as possible. Knowing that Windows, Linux and macOS all have built in 'telnet' capabilities meant I could use this and not have to write a client app as well. I set about making a simple server side app that would interface to any standard 'telnet' app that was easy to use.

After a bit of research I threw some code together which achieved my immediate goal and enabled me to test the connectivity in my environment. I may expand / improve on this at a later date but it got me where I needed be and I figured I would share it with anyone who may also find themselves in my position.

Instructions For Use

Copy the .jar file to any machine you need to test connectivity with. (It will need Java 1.6 or greater installed [jre or jdk] )

1) On the target machine start the port tester with 'java -jar SPORT.jar xxxxx' where xxxxx is the port number, if the xxxxx is omitted the server will prompt you for a port before it begins listening.

2) From the source machine open telnet to the server using 'telnet yyy.yyy.yyy.yyy xxxxx' where yyy.yyy.yyy.yyy is the IP or server name and xxxxx is the port number used when starting the server.

From here it will quickly become aparent if you have connectivity between the two devices. Once running the Port Tester is a simple echo server, so after you have connected anything you type followed by hitting 'enter' will be echoed back to you with an "Echo:" prefix.

To end a connection send 'enter' (to ensure its a fresh buffer) then type 'bye' followed by 'enter' again this will tell the server to disconnect the client and then immediately start listening again on the same port. I made it work in this manner this because I had to test connections to the same server from multiple clients, but please be aware that this simple app will only accept one connection at a time.

If you can think of anything that may make this utility better then please let me know and I will consider adding to it.