问题描述
如何以编程方式确定活动网络连接的网络连接速度(如任务管理器在网络选项卡中显示)?我不是真的在带宽可用后,只是一个数字为当前连接,例如。 54Mbps,100Mbps等。
How do I programmatically determine the network connection link speed for an active network connection - like Task Manager shows you in the Networking tab? I'm not really after the bandwidth available, just a figure for the current connection, e.g. 54Mbps, 100Mbps etc.
推荐答案
最后,我发现 WMI类,因为我需要支持legacy平台,不幸的是, Win32_NetworkAdapter
不会。 Win32_PerfRawData_Tcpip_NetworkInterface
有一个 CurrentBandwidth
属性,它给我在所有必需的平台上我需要的(我意识到我说我没有需要带宽,但它是可接受的,并似乎返回适配器的标称带宽)。
In the end I found the Win32_PerfRawData_Tcpip_NetworkInterface
WMI class, as I need to support legacy platforms which, unfortunately, the Win32_NetworkAdapter
doesn't do. Win32_PerfRawData_Tcpip_NetworkInterface
has a CurrentBandwidth
property which gives me what I need on all required platforms (I realise I said I didn't need "bandwidth" but its acceptable and appears to return the "nominal bandwidth" of the adapter anyway).
感谢所有的人,指出我的方向。
Thanks to all those who posted, pointing me in the right direction.
这篇关于确定网络连接链接速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!