Which service is using which port?

1 minute read

Every day we fell in some difficulties and want to know which service is using by which port? Ports are divided into three ranges: The well-known ports (from 0 to 1023), the registered ports (from 1024 to 49151) and Dynamic (Private) ports (from 49152 to 65535). The Internet Assigned Numbers Authority (IANA) is responsible for the global coordination of the port assignment. Here I will show some tools to figure out the problem. Two well-known utility NETSTAT.EXE and TASKLIST.EXE will be used here.

TASKLIST.EXE is used to know the list of processes with its owing id. When we run >tasklist in command window we see the following output.

Suppose, we want to know which port is used by skype? After running »tasklist you will see the above output. Here you will see Image Name: Skype.exe with process id or PID: 3224. Now if you want to know which process owes process id or PID 3224? Just run »tasklist /FI “PID eq 3224”. You will see the following output.

NETSTAT.EXE is used to identify what ports are being used by a particular process. The syntax that we will be using for NETSTAT.EXE is as follows: netstat.exe –a –n –o. Here,

-a: listing of all connections and listening ports -n: display address and port numbers in numerical form -o: display the owning PID associated with each connection Now after running >netstat –a –n –o , you will see the following screen.

If you look at the output, you will see that local address of PID 3224 is which mean process id 3224 used port 55956. You already know that 3224 is the PID of process Skype.exe. So, you came to know that process skype.exe is used port 55956.