Determining network connection speed

How to programmatically determine the network connection speed for an active network connection - for example, does Task Manager show you on the Network tab? In fact, I do not understand how much bandwidth is available, just a figure for the current connection, for example. 54 Mbps, 100 Mbps, etc.

+4
c ++ windows winapi networking
source share
3 answers

In the end, I found the Win32_PerfRawData_Tcpip_NetworkInterface WMI class, since I need to support legacy platforms, unfortunately Win32_NetworkAdapter does not. Win32_PerfRawData_Tcpip_NetworkInterface has a CurrentBandwidth property that gives me what I need on all the necessary platforms (I understand that I said that I do not need "bandwidth", but is acceptable and seems to return the "nominal bandwidth" of the adapter).

Thanks to all those who sent, pointing me in the right direction.

+2
source share

Win32_NetworkAdapter The WMI class can help you ( Speed property). It returns a value of 54000000 for my WiFi adapter connected to the WiFi-g access point.

+2
source share

.NET way to find out adapter speed

 IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties(); NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); if ( nics != null ) for (int i = 0; i < nics.Length; i++) Console.WriteLine("Adapter '{0}' speed : {1}", nics[i].Name, nics[i].Speed); 

Some adapters are tunnels, so their speed will be returned as 0. For more details, see the NetworkInterface documentation on MSDN.

0
source share

All Articles