[Qt-interest] Checking if connected to the network

Thiago Macieira thiago.macieira at trolltech.com
Sat May 16 17:32:41 CEST 2009


David Ching wrote:
>> Date: Tue, 12 May 2009 11:25:22 -0700
>> From: Ann Marie <annmarieqt at gmail.com>
>>
>> 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?
>
>As Thiago said, Qt doesn't have a cross platform API for this.  If you
> are interested in Windows, use the Windows API
> InternetGetConnectedState().
>
>I'm not sure if the presence of this Windows API means Windows does a
> better job of managing Internet connections than the other platforms,
> or if whatever it does could be implemented on the other platforms.

That function most likely does not handle all cases. I suggest reading the 
MSDN documentation and finding out its limitations.

Most likely, it cannot detect when you're connected to a network, but that 
network is not connected to the Internet.

-- 
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/20090516/c70de918/attachment.bin 


More information about the Qt-interest-old mailing list