Find application using port

寵の児 提交于 2019-12-30 10:25:52

问题


I have a networking program setup that does a lot of what the nestat program does. I am working now on netstat -o. That command will give me the PID of the program using that socket. I have some idea of where to look. I have been trying to use WMI to get that information but so far I have not found a suitable class.

How can I find the PID or application name that is using a particular socket?

I am using c#


回答1:


AFAIK, this information is not exposed anywhere in the BCL or WMI. You'll need to p/Invoke GetExtendedTcpTable to get it.




回答2:


Go here http://www.codeproject.com/KB/IP/iphlpapi2.aspx I have used it and it works really well.



来源:https://stackoverflow.com/questions/3173427/find-application-using-port

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!