开发者

Find application using port

开发者 https://www.devze.com 2023-01-05 11:10 出处:网络
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 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开发者_JAVA百科 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#


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消