[Qt-interest] What's the best way to determine online status?

Arnold Krille arnold at arnoldarts.de
Thu Oct 15 20:41:01 CEST 2009


On Thursday 15 October 2009 16:58:02 Murphy, Sean M. wrote:
> The only way I've thought of at the moment is right when I launch,
> request a page from Google Maps, and set up a QNetworkReply watching for
> a error signal.  If I get an error, then I'll assume I'm on the LAN and
> use the old Qt3 widget for the remainder of that session, if I get the
> reply back successfully from Google Maps, then I'll know I'm online and
> I'll use my WebKit version.

I think this is the only practical (and portable!) solution. Just try what you 
want to do and see if it fails. All the checking-interfaces-and-try-to-guess-
the-right-thing is really just guessing. If the interface is up and has an ip-
address, that is no sign that you are connected to the net. And if the 
device(s) you check are all down, it doesn't really mean that there is no 
connection. Could be there are some obscure interfaces which you didn't check.
And implementing the different check-for-interfaces for the different os'es is 
probably a pain in the...

Why do you use two widgets? Why not use the webview for all display and just 
show the google-maps background only when a connection is made?

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091015/f0c3609d/attachment.bin 


More information about the Qt-interest-old mailing list