Friday, September 06, 2013

How to find which application is using a TCP port in Windows

If a port is already in use by some unknown program and when you try to use the same port , you get a lot of errors like "Port already in use" , "Bind Exception" , "Port 80 already in use" etc. So in such case, You have to find out which process is already using this port and you can kill that process.

Steps to find which application is using a TCP port in Windows

  1. Type the command to find the Process ID
  2. Go to Run -> cmd and Type
     netstat -ano | more 
    Now in the output, Just find out the line which uses your port (look at second column, that is the local Address ) and the find the corresponding process id at the last column of that line. See a sample output in the below figure. For example, in the figure, Port 135 is used by a process with PID 916.

  3. Now find which is the process with PID 916.
  4. For that type,
    tasklist /svc /FI "PID eq 916"
    This will list the Process Name.
  5. Now if you want to kill the process, You can give the command
     taskkill /F /PID 916

No comments:

Post a Comment