Solved get the interface of network
-
how can i get what interface is system is using to connect Internet??
i want to know if system using wifi or Ethernet to go online.is there any way?
-
Check active configuration in QNAM: https://doc.qt.io/qt-5/qnetworkaccessmanager.html#activeConfiguration
And there, you can check BearerType. https://doc.qt.io/qt-5/qnetworkconfiguration.html#BearerType-enum
-
@sierdzio i wrote this
qDebug()<< QNetworkConfiguration::Active;
output is "14" .
i am using my mobile Tethering .
-
You have just printed the int value of an enum ;-) That won't tell you anything.
QNetworkAccessManager manager; const auto config = manager.activeConfiguration(); qDebug() << config.bearerType() << config.bearerTypeName();
-
thanks it's working.