Check if internet connection is available?


#1

Hi,
does any of you know if is there is a built-in function in Juce to check if an internet connection is available?
Checked Url class already, but maybe there’s another place. Just making sure I didn’t miss something.
Otherwise, a quick check to see if http://www.google.com gives something back could be an alternative I guess :wink:
Or are there other/better ways?
Koen


#2

AFAIK the OSes don’t provide that info - I’d suggest pinging google.com or other big sites as the only reliable way to find out.


#3

Alright, that’s what we’ll do.
Thanks for confirming.
Koen


#4

Hi Jules,

I'd like as well to test my internet connexion;

Could you write down a sample of code that pings a website, please?

Thanks


#5

Just try to read from google.com and see if you get any data back.


#6

There are lots of reasons specific bits of internet might not be available as well.  You have to be careful what you test for.  You could easily be in a situation where google is available but other sites aren't.  If you are behind a company proxy server for example, or other random filtering. 

Ping is very unreliable unless you know what you are doing. 

Also - depending on the situation you may get a quick yes or no, or you may have to wait ages for the connection to time-out. 

What are you trying to achieve?