[Qt-interest] Checking if connected to the network

Thiago Macieira thiago.macieira at trolltech.com
Sun May 17 10:32:59 CEST 2009


David Ching wrote:
>A cross-platform API providing this functionality would be very useful;
> one common usage is to avoid a potentially long delay in trying to
> establish a connection without a network cable attached, or causing a
> dial-up adapter to dial.  Once this API confirms basic network
> connectivity, testing for true Internet connectivity would simply be
> connecting to a well known address such as google.com.  For
> convenience, a cross platform API that does this would also be useful.

See QNetworkInterface. If the attribute "Up" is set, then the interface is 
active.

The interface being active doesn't mean anything, though: some systems set 
that attribute even with cable disconnected or wi-fi unassociated. But it's 
the best you're going to get.

On my Linux laptop, ifplugd unsets Up if the wi-fi disconnects or the cable 
is pulled away. But ifplugd doesn't detect when the wifi firmware crashed 
and stopped transmitting/receiving.
-- 
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/20090517/344fd47a/attachment.bin 


More information about the Qt-interest-old mailing list