Whenever an application wants to make itself accessible over the network, it claims a TCP/IP port, which means that port can’t be used by anything else. So if you need to use an in-use port, how do you tell what application is holding it?
There’s a number of ways to tell what application has the port locked, but we’ll walk through the built-in way using the command line and Task Manager, and then a great freeware application that does it all in one utility.
Use Built-In Tools to See What is Listening on a Port
The first step is to use a command-line tool to see what ports are in use, and use a special flag that tells us which port is assigned to each Windows process identifier number. Then we can use that number to look up exactly which process it is.
Open up a command prompt and type in the following—you may have to open in Administrator mode to see all processes:
netstat -aon | more
If you look on the right-hand side, you’ll see where I’ve highlighted the list of PIDs, or Process Identifiers. Find the one that’s bound to the port that you’re trying to troubleshoot—for this example, you’ll see that 0.0.0.0:80, or port 80, is in use by PID 4708.
Now you can simply open up Task Manager—you might have to use the option to Show Processes for All Users, and then you’ll be able to find the PID in the list. Once you’re there, you can use the End Process, Open File Location, or Go to Service(s) options to control the process or stop it.
Use CurrPorts to View What is Listening
If you aren’t really the command-line type, or you’d rather just use a simple utility to do it all in one step, you can use the excellent freeware CurrPorts utility by NirSoft, one of our favorite freeware authors.
Just open up the utility, and you can see everything—processes, ports, remote ports, the full path to the process.
If you double-click on any of the items, you’ll see every single detail.
You can also use CurrPorts to directly kill the process if you want.
Monday, September 20, 2010
How Can I Tell What is Listening on a TCP/IP Port in Windows?