How to find which program is using a specific Windows port?

If you experience a python – Error: That port is already in use, or Apache’s: Port 80 in use by “Unable to open process”, it’s very likely that another program is already using the port. For anyone who ever experiences this kind of issue, or whenever you suspect that something else is using one of the ports, please follow these instructions to resolve the problem and find which program is using a specific Windows port.

In windows, go to Start / Accessories, then right click on ‘Command Prompt’, in the menu click on ‘Run as Administrator’, just like this:

2016-12-06_5-52-13

Then run ‘netstatanb | findstr :80‘ command, or any other port.

For example, my PHP code is running in my browser on port 8000, to see if anything is using port 8000, I can run netstat –anb | findstr :8000‘ command in command prompt. Output would look like this, telling me that something is already using the port:

2016-12-06_5-55-30

In this case, it’s okay, because it’s my web server that is using port 8000,  I could confirm that by opening the browser at localhost:8000, but if it were another program, this would let you know.

Another option is to use a free network monitoring software such as CurrPorts, which displays the list of used TCP/IP and UDP ports on your local computer. The advantage of this utility is not only that it’s completely free, but it shows you exactly which program is using the port in question, such as in my case it’s php.exe that is listening on port 8000. The program also allows you to kill the connection that ties up the port, if you’re unable to find the process yourself:

2016-12-06_6-11-05

CurrPorts can be downloaded from: http://www.nirsoft.net/utils/cports.html, just nore that download links are towards the bottom of the page (page layout is quite confusing).

Comments

comments