用netstat -ban(或-oan)的.NET等价 [英] Netstat -ban (or -oan) equivalent in .NET

查看:97
本文介绍了用netstat -ban(或-oan)的.NET等价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如果一个特定的进程正在使用指定端口,即 netstat的-ban 。我碰到使用 IPGlobalProperties 来获得活动连接的列表中,但是这似乎并没有包含过程信息。

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.

这将是很好,如果存在某个类在C​​#中,让我以编程方式做到这一点。理想情况下,我就不会去管CMD壳进程输出。

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.

推荐答案

请看到这个问题...

Please see this question...

<一个href="http://stackoverflow.com/questions/577433/which-pid-listens-on-a-given-port-in-c">http://stackoverflow.com/questions/577433/which-pid-listens-on-a-given-port-in-c

基本上你的PInvoke GetExtendedTcpTable()

Basically you PInvoke GetExtendedTcpTable()

这篇关于用netstat -ban(或-oan)的.NET等价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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