View Full Version : Checking for internet connection
c1223
13th November 2013, 01:16
I can't seem to find in the documentation how one can check whether there is an active internet connection available. I was looking at the QNetworkSession class but can't seem to work it out.
Thanks
anda_skoa
13th November 2013, 10:31
Maybe through this?
http://qt-project.org/doc/qt-5.0/qtnetwork/qnetworkconfigurationmanager.html#isOnline
Cheers,
_
c1223
13th November 2013, 14:32
Thanks. I did try that. Returns true even when there isn't any connectivity.
Lesiok
13th November 2013, 14:45
I think the only way is to try to connect to a server at a well-known address.
anda_skoa
14th November 2013, 10:15
I think the only way is to try to connect to a server at a well-known address.
Right, depends on what kind of information the thread starter was looking for.
Obviously if the question is "can I reach a specific host" then the only way to determine that is to try to connect to it.
The network configuration classes only tell you if there is even a point in trying that, i.e. if there is no connected network interface then any attempt will fail locally already.
Cheers,
_
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.