What port is a given program using? [closed]

2019-01-12 22:22发布

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.

12条回答
太酷不给撩
2楼-- · 2019-01-12 22:47

At a command line, netstat -a will give you lots o' info.

查看更多
霸刀☆藐视天下
3楼-- · 2019-01-12 22:48

Windows comes with the netstat utility, which should do exactly what you want.

查看更多
▲ chillily
4楼-- · 2019-01-12 22:49

"netstat -natp" is what I always use.

查看更多
太酷不给撩
5楼-- · 2019-01-12 22:51

Windows 8 (and likely 7 + Vista) also provide a view in Resource Monitor. If you select the Network tab, there's a section called 'Listening Ports'. Can sort by port number, and see which process is using it.

查看更多
Rolldiameter
6楼-- · 2019-01-12 22:52

You may already have Process Explorer (from Sysinternals, now part of Microsoft) installed. If not, go ahead and install it now -- it's just that cool.

In Process Explorer: locate the process in question, right-click and select the TCP/IP tab. It will even show you, for each socket, a stack trace representing the code that opened that socket.

查看更多
我想做一个坏孩纸
7楼-- · 2019-01-12 22:55
登录 后发表回答