windows 如何在windows中找到进程持有的套接字列表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8902136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find a list of sockets held by a process in windows?
提问by Sriram Subramanian
I have a .Net application that maintains a socket pool to reuse them. It is suspected that it might be holding too many of those sockets without releasing them. Is there a way to find the number of socket handles the application is holding to in Windows?
我有一个 .Net 应用程序,它维护一个套接字池以重用它们。怀疑它可能持有太多这些套接字而不释放它们。有没有办法找到应用程序在 Windows 中持有的套接字句柄的数量?
回答by selbie
Type netstat -a -o -n -b
from an elevated (admin) command prompt.
键入netstat -a -o -n -b
从升高(管理员)命令提示。
-b
is to display the executable involved in creating each connection or listening port. See netstat --help
for a list of all options.
-b
是显示创建每个连接或侦听端口所涉及的可执行文件。查看netstat --help
所有选项的列表。
回答by PhysicalEd
I like TCPView from SysInternals: http://technet.microsoft.com/en-us/sysinternals/bb897437Good for lots of other things too, but to check your own process out, just find it in the list and look at the sockets it has open, addresses they are bound to, etc. You can also watch the dynamic pattern of your processes socket usage.
我喜欢 SysInternals 的 TCPView:http: //technet.microsoft.com/en-us/sysinternals/bb897437 也适用于许多其他事情,但要检查您自己的进程,只需在列表中找到它并查看套接字它有打开的地址、绑定的地址等。您还可以查看进程套接字使用的动态模式。