What port is a given program using?

networking, windows

Solution

`netstat -b -a` lists the ports in use and gives you the executable that's using each one. I believe you need to be in the administrator group to do this, and I don't know what security implications there are on Vista.

I usually add `-n` as well to make it a little faster, but adding `-b` can make it quite slow.

Edit: If you need more functionality than netstat provides, vasac suggests that you try TCPView.

Problem

I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on my computer? PS - before you downmod this for not being a programming question, I'm looking for the program to test some networking code.

Original source