9 years, 2 months ago.

Strategy to periodically check internet connectivity on mbed?

Hi,

The project I am working on needs to communicate with an application server periodically. When that application server is not accessible, It would be nice to know whether the internet as a whole is down (because of power outage, failure of local IT infrastructure etc) or just the application server itself (because of censoring or server data center down etc) .

The question is: what would be the best or a good strategy?

The best approach to me seems to be NTP, if a network time server is accessible, then the internet is working. Unlike certain sites like google, wikipeida, I don't see any reason a NTP server would be blocked/censored by any authorities. But so far I didn't have luck trying this approach. I have another thread describing the issue: http://developer.mbed.org/questions/6263/NTPClientsetTime-returns-NTP_OK-even-whe/

The other option is to try to access a few sites with high availability like apple.com, Microsoft.com, if none of these sites can be reached then the internet as a whole is down.

The only problem is that the homepage of those sites is usually very much bloated, and requires too much resource to handle(speaking of embedded system like mbed).

Do you guys have any suggestions?

Thanks in advance ZL

2 Answers

9 years, 2 months ago.

I have never spend much time on internet applications, but isn't it simply possible to send a ping request?

I don't think ping has been implemented in mbed yet. But as you said, it can be as simple as try to open a socket at certain server.

The problem is which server(s) to use. For development purpose, the "hello.txt" on mbed site works perfectly well. But for deployment purpose, I am not quite sure. This "hello.txt" might be deleted or moved to other places over time. This actually happened once when mbed.org became developer.mbed.org.

Other sites like google.com or Wikipedia are censored in certain countries, and they probably don't like being pinged or harassed by poor clients like mbed either.

Of course if you guys can kindly set up some fixed page that all mbed based product can access over extended period of time, it will be great. As mbed matures, I can imagine a lot of mbed based products will be released soon. It would be fun to watch how many times that page being accessed ,

posted by Zhiyong Li 13 Feb 2015
9 years, 2 months ago.

You and me both Erik.

Have a look here, Mbed has a test page that you can effectively 'ping' where you can confirm internet connection.

http://developer.mbed.org/handbook/Ethernet-Interface

I have not tried this (on my todo list) perhaps you could update here if it does the trick.