Samuel Sieb wrote:
NetworkManager has a few different states of connected. There are at least NETWORK_LOCAL which seems to mean it has an IP address and NETWORK_GLOBAL which means it has internet access. There might another one in between as well.
Joe Zeff:
Considering that not all computers use DHCP, NETWORK_LOCAL should probably include pinging the gateway but probably doesn't.
That still wouldn't prove the internet is accessible. My ISP could be failing, or suspended my account, or the cable between my gateway to my ISP unplugged, but my gateway would still be alive (in itself).
You'd have to do some other check that went out onto the internet, to prove you were fully on-line. e.g. Check the time on a NTP server, use one of those "find my outside IP" services, etc.
Even then, that only checks what it checks. Your external mail service could be totally inaccessible while you could still be able to surf the web.