Detecting network type is 3G or Wifi
Hello,
I would like my application to behave differently for Wifi and 3G network.
The problem is that my application has to detect which network that QNetworkAccessManager is using.
For Qt 4.7, QNetworkAccessManager has a method called configuration() which returned the configuration used for creating connection.
If I want to do the same thing for Qt4.6, how do I do that? (4.6 does not have configuration method).
Any idea aboyt this?
Thank
Hai
Re: Detecting network type is 3G or Wifi
If Qt-4.7 already has this:
http://qt.gitorious.org/qt
You can look at the code of QNetworkAccessManager.
Re: Detecting network type is 3G or Wifi
Thanks for your link.
A quick look to QNetworkAccessManager.createRequest() shows that
Code:
if (!d->networkSession && (d->initializeSession || !d->networkConfiguration.isEmpty())) {
966
QNetworkConfigurationManager manager;
967
if (!d->networkConfiguration.isEmpty()) {
968
d->createSession(manager.configurationFromIdentifier(d->networkConfiguration));
969
} else {
970
if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)
971
d->createSession(manager.defaultConfiguration());
972
else
973
d->initializeSession = false;
974
}
975
}
Thus, QNetworkAccessManager use NetworkConfigurationManager.defaultConfiguration() .