我已获得(使用vb.net)网络适配器/接口的列表,其中包含网络适配器名称、描述和最大速度(1 Gb、10 Gb等),使用:
Dim AllNetworkInterfaces() As System.Net.NetworkInformation.NetworkInterface = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
For Each ThisNI As NetworkInterface In AllNetworkInterfaces
Console.WriteLine(ThisNI.Name & " " & ThisNI.Speed & " " & ThisNI.Description)
Next
字符串
名称速度说明
“Media Network 10 Gb”10000000“英特尔以太网连接适配器#2”(后面还有其他适配器)
我还获得了每个网络接口的“bytes sent/sec”性能计数器,即
“Instance Name”“bytes send/sec”“Intel Ethernet Connection Adapter _2”176.5
理想情况下,我希望能够与我的代码显示适配器名称,适配器描述,速度(最大)和实际速度(字节发送/秒)。但是,性能计数器数据标识和网络适配器标识之间似乎没有直接关联。例如,如上所述...
GetAllNetworkInterfaces返回NAME和SPEED,其中的描述包含一个哈希标记以标识接口的编号。
性能计数器返回它标记为“示例名称”的内容,但这实际上是网络接口的“描述”(而不是名称),并且散列标记已替换为下划线。
我没有看到任何方法来“链接”这两组数据,因为这两组数据之间的描述是不同的,并且性能计数器没有返回接口的真实NAME。
是否有其他方法可以从性能计数器中获取的实际速度沿着真实名称和描述?
1条答案
按热度按时间mitkmikd1#
description和instance的值相似,但不完全相同
但是你可以使用类似的字符串替换,来得到正确的结果
字符串
这在我的电脑上工作,可能需要更多的更换