0
votes

I want to make an open source app which should know if it can access the outside world (aka the Internet). It can be blocked from the Internet for various reasons, such as not configured proxies or those annoying browser authentications from wireless networks.

Is there some kind of service which I can ping to see if I have access to the Internet, or some recommendation or common practice on verifying it? I know I can just e.g. ping Google but I would prefer to use some specific service or adopt a best practice.

3
If it needs to access some site on the internet, just try to access it. All you can really verify by picking some particular site to ping is to verify it can access the ping site, not whatever resource you actually need to access.Wooble
@Wooble the point is: it does not need to access any resource. My app should discover if the computer is online so it can ask the user for more configuration info.brandizzi

3 Answers

1
votes

Well as you say it yourself : you just want to know if the Internet is accessible with a ping. A ping won't return you more than a success, so I don't see what kind of additionnal service you could get. And as stated, you could use Google. My guess would be that you should pick something safe, that you know you'll have an answer from even if they have problems on their end : so what could be best than pinging Google ? If there's Internet connectivity, that will work better than anything.

If you were to get more information about your connectivity (latency, location or whatever) you could think of using a specific service, but pinging Google seems the best here.

1
votes

Best practise is to ping (or otherwise make a connection) to a service that you're paying for!

You should not burden other parties with the cost of receiving your "network up" probes - that's a form of network abuse.

See for example http://en.wikipedia.org/wiki/NTP_server_misuse_and_abuse

0
votes

You could have your application request a website. Here is an easy way to do it. Telnet www.google.com 80 GET /

Response will be the HTML of the website.

Once you get off the ground and running, you can have the app ping the IP of and request the page of your project's website.

I hope this helps.