Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved How to get speed network interface

    General and Desktop
    2
    3
    184
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • blackout69
      blackout69 last edited by blackout69

      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

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • blackout69
          blackout69 last edited by

          @sgaist said in How to get speed network interface:

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

          Yes.
          blackout69

          1 Reply Last reply Reply Quote 0
          • First post
            Last post