Which Service is using which port?

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.

tasklist

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.

Tasklist pid

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.

netstat

If you look at the output, you will see that local address of PID 3224 is 0.0.0.0:55956 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.

Please share, if it is helpfulShare on FacebookShare on LinkedInTweet about this on TwitterShare on Google+Email this to someonePrint this page

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>