How to Create Port Listener in Windows or Linux– Handy for Connectivity Test

One of many difficult duties whereas working within the challenge workforce is to carry out the required connectivity take a look at though companies don’t exist.

That is typically crucial in case you are working in a DMZ setting for migration or new initiatives. Let’s take a real-time instance: you might be engaged on migration and you should guarantee connectivity between software “A” to “B” on a selected port.

Good. It is simple so that you can act telnet however what about if “B” has no service by any means? That is the place you want the port listener that will help you on this state of affairs.

You probably have an analogous state of affairs or suppose it might be useful for you at work, listed here are some methods to realize it on the Home windows or UNIX platform.

To create submit listener in Home windows OS

To have a port listener on a selected port in Home windows, you need to use the “Port Listener” utility.

This utility is offered free of charge for Home windows 95 to Home windows 10.

port listener windows

  • Obtain Publish Listener as zip or exe format from right here
  • On this information, I obtain the exe format
  • Double-click the downloaded postlistener.exe file
  • You’ll be prompted to pick the situation the place to extract the recordsdata, click on extract

port listener extract

  • Go to the trail the place you extracted the recordsdata, on this instance; I’ve at c:listener

port-listener folder

  • Double-click the listener to launch the utility
  • Enter the port quantity you need to take a look at and click on begin

port-listener-listen

  • Within the instance above, I began listening on port 5500, and it is time to validate if it is lively.

Open a command immediate and run netstat to validate that port 5500 is listening

netstat listening windows

So sure, now I’ve efficiently created a port listener in Home windows.

To create submit listener in Linux OS

The process is barely totally different in Linux; right here we are going to use the netcat(nc) command to start out the listener.

  • To put in nc, you need to use the yum command
yum set up nc
  • As soon as put in, use the next command to start out the background port listener as 5500.
nc –l 5500 &
  • Let’s use the netstat command to validate this
[root@Chandan ~]# netstat -anlp |grep 5500
tcp       0     0 0.0.0.0:5500               0.0.0.0:*                   LISTEN 
   21085/nc          
[root@Chandan ~]#

So right here I efficiently listened to port 5500. Doing this on Linux is a little more comfy, is not it?

Create a port listener with Python

The above two examples are restricted to the working system. What about having a Python script that may run on Home windows or UNIX?

Properly, I discovered the Python code under that works on each Home windows and Linux. Create a file – as an instance portlistener.py with the code under

'''    Easy socket server utilizing threads
'''
import socket
import sys
HOST = ''   # Symbolic identify, which means all obtainable interfaces
PORT = 5500 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
#Bind socket to native host and port
attempt:
    s.bind((HOST, PORT))
besides socket.error as msg:
    print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
    sys.exit()
print 'Socket bind full'
#Begin listening on socket
s.hear(10)
print 'Socket now listening'
#now preserve speaking with the shopper
whereas 1:
    #wait to just accept a connection - blocking name
    conn, addr = s.settle for()
    print 'Related with ' + addr[0] + ':' + str(addr[1])
s.shut()

Save the file and run it with the Python command as proven under

[root@Chandan ~]# python portlistener.py
Socket created
Socket bind full
Socket now listening

Considering studying Python? Then view this on-line course.

I hope the above process helps you create a port listener for the connectivity exams.

Leave a Comment

porno izle altyazılı porno porno