Re: Checking for internet connection.

From: Date: Sun, 20 Dec 2009 19:29:49 +0000
Subject: Re: Checking for internet connection.
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-300614@lists.php.net to get a copy of this message
> 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. > Hence no overhead of actually connecting, > because that won't even start to happen until the hostname is resolved > to an IP. If it happens to resolve from some cache, oh well. Not > like its that much overhead. You're nitpicking over the number of > packets it takes to SYN/ACK. Yep and if it's running inside a LAN with x number of computers all doing the same thing, that mounts up to a lot of unnecessary traffic - I've seen it.

« previous php.general (#300614) next »