Best way to determine Internet Connection (Vote/Advice)

DNS resolution is not enough. It may be cached locally. You also need to connect to the actual address to know if you have an internet connection.

If you generate a different random fictitious address each time, it won’t be in the local cache. And if you can contact a DNS server, then you’re connected to the Internet, no?

check one server from continent, if all are down, chances are you don’t have internet …

Greg is right. Ultimately, what counts is to have the connection to the server you want to reach.

Not necessarily.