Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get speed network interface



  • Hi,
    how to get the connection speed of a given network interface?
    My code is:

      foreach (const QNetworkInterface &interface, QNetworkInterface::allInterfaces())
        {
          QNetworkInterface::InterfaceFlags flags = interface.flags();
          if ((flags & QNetworkInterface::IsRunning) && !(flags & QNetworkInterface::IsLoopBack))
            {
              foreach (const QNetworkAddressEntry &address, interface.addressEntries())
                {
                  if (address.ip().protocol() == QAbstractSocket::IPv4Protocol)
                    {
                      qDebug() << interface.humanReadableName();    // Nome Interfaccia
                      qDebug() << address.ip().toString();          // IP Address
                      qDebug() << address.netmask().toString();     // Subnet Address
                      qDebug() << interface.hardwareAddress();      // MAC Address
                      qDebug() << ................................. // Speed Network
                    }
                }
            }
        }
    

    Thank you
    blackout69


  • Lifetime Qt Champion

    Hi,

    Do you mean getting whether it's in 10/100/1000Mb link state ?



  • @sgaist said in How to get speed network interface:

    Do you mean getting whether it's in 10/100/1000Mb link state

    Yes.
    blackout69


Log in to reply