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.
-
What if the system has more than one adapter? There's no concept of a single "active network connection". – John Saunders May 11 '09 at 21:01
-
Similar: http://stackoverflow.com/questions/849375/determine-network-interface-bandwidth-type-without-transferring-data – lothar May 11 '09 at 22:26
3 Answers
Win32_NetworkAdapter
WMI class can help you (Speed
property). It returns the value 54000000 for my WiFi adapter connected to a WiFi-g access point.

- 414,610
- 91
- 852
- 789
-
Thanks for the reply. Unfortunately, the explanation of that property states, "This property has not been implemented yet. It returns a NULL value by default"? – binarybob May 11 '09 at 20:44
-
You are right about MaxSpeed. I remember I have worked with the Speed property. I'm sure Speed works on Vista and Windows 7. – Mehrdad Afshari May 11 '09 at 20:44
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.

- 3,529
- 3
- 23
- 21
.NET way how to know adapter speed is
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. Read NetworkInterface documentation on the MSDN for more information.

- 1,974
- 18
- 22