[Qt-interest] how to detect interenet connection ? or that the internet is down
Arnold Krille
arnold at arnoldarts.de
Sun Apr 11 21:06:38 CEST 2010
On Sunday 11 April 2010 14:32:14 Meir Yanovich wrote:
> im developing desktop application that using internet heavlly , but now i
> need to develop mechanizem
> to detect that the internet connection is down , that mean i can't connect
> to the internet
> what is the best way to implement such mechanism ?
This question is raised regularly on this list, mostly by developers who
aren't admins...
The result of each of these discussions:
The only way of "checking" for internet-connection is actually trying to do
what you are after and have proper error-handling.
Detecting a gateway by upnp is fine as long as there is a gateway to detect via
upnp. If there isn't you are in trouble.
Checking whether the computer has a valid public ip is asking for trouble in
almost all private and corporate networks.
Pinging google doesn't necessarily mean that your stuff is working too (unless
pinging google is the purpose of your app).
Resolving a host-name to ip-address doesn't mean that the machine is allowed
to send and receive data for the task you are after.
And even if one of the above methods work and your initial real request works
too, you still need proper error-handling in case the connection fails later
on. So just do what you want to do and deal with the errors and timeouts like
you are supposed to be. There is no other reliable way of determining whether
your stuff will work.
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/20100411/b7a874bf/attachment.bin
More information about the Qt-interest-old
mailing list