[Qt-interest] Checking if connected to the network
Thiago Macieira
thiago.macieira at trolltech.com
Wed May 13 01:15:04 CEST 2009
Ann Marie wrote:
>Could someone provide me with some information/sample code on how my qt
>applicatoin can check and see if the machine it is running on is
> connected to the network?
In general, probing a medium to check if you can use the medium isn't very
effective. I'd suggest you simply try to do what you were going to do
before. [*]
Besides the fact that Qt doesn't have any "am I connected" API, there are
a number of reasons why attempting to check that will not work. First of
all, you could be connected to a network, but that network isn't connected
to the Internet. Second, you could be connected to the wrong network, or
not connected to enough networks yet (multihomed systems). Some systems
even report that the connection is up, while they have no connection at
all.
So, my recommendation is that you simply do what you were going to do if
you were connected. And if that operation fails, you're not connected to
the right networks.
[*] For example, here's how this applies to mailing lists: don't send an
email "test" to check if you can post to a mailing list. Instead, send the
email you were going to send if your test had succeeded. If it doesn't
arrive or it bounces, then you can't post.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Software
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090513/74a60dbd/attachment.bin
More information about the Qt-interest-old
mailing list