Thursday, May 13, 2010

Find a Process Using a Port

Every once in a while you run into a situation where two applications are attempting to use the same port number. Of course this means that one application is blocked out and doesn't function properly.

In a perfect world, we'd know all the ports used by various pieces of software on our servers and instantly understand where the conflict is. However, we don't live in perfect world, and some apps pick random port numbers.

On a Windows server, you friend is netstat -ab > C:\portlist.txt. This command dumps a list of ports and the processes using those ports to a text file. Then you can find out which process is conflicting with your failed service/application.

I used this just today to find out that a watchguard logging process was using port 4101 that a BES routing service wanted to use. I've also used it in the past to find out that Symantec Mail Security was randomly selecting a port in the low 10xx range that another application wanted to use.