This is often you have to do when you are working in a DMZ environment for migration or new projects. Let’s take a real-time example – you are working on migration, and you have to ensure connectivity exists between application “A” to “B” on a particular port. Well. It’s straightforward you can perform telnet but how about when “B” doesn’t have any service running? That’s where you need the port listener to help in this situation. If you have a similar situation or feel this would be beneficial for you at work, then here are few ways to achieve this in Windows or UNIX platform.

To create post listener in Windows OS

To have a port listener on a specific port in Windows, you can use the “Port Listener” utility. This utility is available for free for Windows 95 to Windows 10.

Download Post Listener as zip or exe format from here In this guide, I will download the exe format Double click on downloaded postlistener.exe file It will prompt to select the location to extract the files, click on unzip

Go to path where you have extracted the files, in this example; I have at c:listener

Double click on listener to start the utility Enter the port number which you want to test and click on start

In the above example, I have started listening port on 5500, and it’s time to validate if it’s running.

Open a command prompt and run netstat to validate if port 5500 is listening

So yes, now I have created a port listener successfully in Windows.

To create post listener in Linux OS

The procedure is slightly different in Linux; here we will use netcat (nc) command to start the listener.

To install nc, you can use yum command

Once installed, use the following command to start the port listener as 5500 in the background.

To validate, let’s use netstat command

So here I have port 5500 listened successfully. Doing this in Linux is slightly more comfortable, isn’t it?

To create a port listener using Python

The above two examples are limited to OS. How about having a python script that can work on Windows or UNIX? Well, I found the below python code which works on Windows and Linux both. Create a file – let’s say portlistener.py with below code Save the file and run it with python command as shown below Interested in learning Python? Check out this online course. I hope the above procedure helps you to create a port listener for the connectivity tests.

How to Create Port Listener in Windows or Linux  Handy for Connectivity Test - 29How to Create Port Listener in Windows or Linux  Handy for Connectivity Test - 37How to Create Port Listener in Windows or Linux  Handy for Connectivity Test - 58How to Create Port Listener in Windows or Linux  Handy for Connectivity Test - 3How to Create Port Listener in Windows or Linux  Handy for Connectivity Test - 31