枚举所有打开的连接 [英] Enumerate all open connections

查看:67
本文介绍了枚举所有打开的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 .NET 枚举当前进程的所有打开连接?(类似于 netstat 工具执行此操作的方式)

Is it possible to enumerate all open connections of the current process using .NET? (similarly to the way the netstat tool does this)

推荐答案

        IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
        TcpConnectionInformation[] connections = properties.GetActiveTcpConnections();

您必须将此数组转换为 IEnum

you have to convert this array to IEnum

这篇关于枚举所有打开的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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