Netstat -ban (or -oan) equivalent in .NET

一个人想着一个人 提交于 2019-12-10 17:13:29

问题


I'd like to know if a particular process is using a given port, i.e. netstat -ban. I came across using IPGlobalProperties to get the list of active connections, but this doesn't seem to include process information.

It would be nice if there exists some class in C# that lets me do this programmatically. Ideally, I wouldn't have to pipe the cmd shell Process output.


回答1:


Please see this question...

Which PID listens on a given port in c#

Basically you PInvoke GetExtendedTcpTable()



来源:https://stackoverflow.com/questions/2775648/netstat-ban-or-oan-equivalent-in-net

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