Determining the network connection link speed

前端 未结 3 1757
借酒劲吻你
借酒劲吻你 2021-01-06 09:53

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 a

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-06 10:50

    .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.

提交回复
热议问题