How to get speed network interface
-
wrote on 5 Sept 2019, 16:32 last edited by blackout69 9 May 2019, 16:58
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 -
Hi,
Do you mean getting whether it's in 10/100/1000Mb link state ?
-
wrote on 5 Sept 2019, 18:18 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 -
wrote on 15 Oct 2023, 08:51 last edited by
Does anyone have a solution ?
-
@fa_2 said in How to get speed network interface:
Does anyone have a solution ?
No, Qt has no option for this. You have to go low-level by yourself.