我想检查Windows 7中哪个应用程序使用的端口 [英] i want to check which port is used by which application in windows 7

查看:115
本文介绍了我想检查Windows 7中哪个应用程序使用的端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检查Windows 7中哪个应用程序使用了哪个端口。

how i check which port is used by which application in windows 7.

推荐答案

在Windows上进行调试时,使用netstat -an



以编程方式在c#中有几种可能性

1.执行上面的命令并解析输出(没有好的做法,但广泛传播)

请参阅 http://www.cheynewallace.com/get -active-ports-and-associated-process-names-in-c / [ ^ ]或 http://stackoverflow.com/questions/1675077/how-do-i-get-process-name-of-an-open-port-in -c [ ^ ]

2.您可以使用Windows防火墙参见 [ ^ ]我敢打赌,有一种方法可以监控活动进程的端口。但是这样你的应用程序将需要提升权限(需要以管理员身份运行)。

3.纯网络中更高级和本机的方法可能这有助于 http://stackoverflow.com/questions/1819364/how-to-determine- tcp-port-used-by-windows-process-in-c-sharp [ ^ ]但我认为它不会给你相应的进程ID。

4.在旧的c / c ++代码上使用一些编组,例如 http://stackoverflow.com/questions/577433/which-pid-listens-on-a-given-port-in-c-sharp [ ^ ]和获取盒子上的活动TCP / UDP连接 [ ^ ]

我认为第一个链接和最后一个链接是你最好的赌注。玩得开心。
On Windows for Debugging purpose at the console use netstat -an

Programmatically in c# there are several possibilities
1. Execute the upper command and parse the Output (no good practice but widely spread)
see http://www.cheynewallace.com/get-active-ports-and-associated-process-names-in-c/[^] or http://stackoverflow.com/questions/1675077/how-do-i-get-process-name-of-an-open-port-in-c[^]
2. you can use the Windows Firewall see [^] I bet there is a way to Monitor the ports of active processes. But this way your app will need elevated rights (Needs to run as admin).
3. a more advanced and native approach in pure -net maybe this helps http://stackoverflow.com/questions/1819364/how-to-determine-tcp-port-used-by-windows-process-in-c-sharp[^] but I think it doesn't give you the according process id.
4. use some marshaling on old c/c++ code like http://stackoverflow.com/questions/577433/which-pid-listens-on-a-given-port-in-c-sharp[^] and Getting active TCP/UDP connections on a box[^]
I think the first link and the last link are your best bets. have fun.


这篇关于我想检查Windows 7中哪个应用程序使用的端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆