RE: [PHP] Checking for internet connection.

From: Date: Mon, 21 Dec 2009 14:05:10 +0000
Subject: RE: [PHP] Checking for internet connection.
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-300624@lists.php.net to get a copy of this message
From: Andy Shellam >> By attempting to connect you will implicitly query DNS (which itself >> is a connection to server). > > No it's not - it's putting out a packet targeted at an IP address > and hoping a server will answer - hence why multi-cast works for > DNS because you're not directly connecting to a specified server, > like you do with TCP/IP. I believe it's similar for ping which is > why it's used so commonly in monitoring applications. > > > If you're not online you won't be able to >> resolve the domain name. > > Exactly - so if all the OP wanted to check for was a working > Internet connection, then DNS is a better way to go IMHO. Both at home and at work there are caching DNS on the LAN. So a DNS request may come back with a valid IP address when the WAN connection is down. I still won't be able to connect to the remote site. Bob McConnell

« previous php.general (#300624) next »