[Qt-interest] Checking if connected to the network

Stephen Collyer scollyer at netspinner.co.uk
Wed May 13 10:19:59 CEST 2009


2009/5/13 Thiago Macieira <thiago.macieira at trolltech.com>

> 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. [*]
>

This isn't necessarily a solution - maybe the OP merely wants to display a
"network available" indication at the start-up of an app, in which case
there is no particular operation to be performed.

The only real solution, as you pointed out, however, involves performing
network activity, but I would suggest performing an idempotent operation
from a well-known address. For example, maybe you can connect to the
telnet/ssh port of a local server, or make a DNS query, or query an NTP
server, or similar.

[ and apologies to Thiago for hitting the wrong reply button .. ]

-- 
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090513/558123c4/attachment.html 


More information about the Qt-interest-old mailing list