is there a fast way to let esp8266 check internet connection?
Meaning, perhaps, if NTP server is available then it's 'checked' (good/ok).
I have an esp8266 (NODEMCU) logging my internet connection. It connects to my router via WiFi and pings a couple of sites - google and my own site. It also checks my network.
I also have an ESP32 powered display showing the latest up time, total down time since reset, ping time and a quality metric.
is there an example?
I tested before ping for example google but if global internet cut so esp8266 hang for some time so I am looking for fastest way to check if global internet cut
You like to check if your ESP is connected to wifi? Go to the router settings. If the ESP is displayed, you are connected, and if not, you are not connected yet.
I hope I could help you further,
cloudDev
dear, I am not talking about wifi connection,
sometimes global internet cut form provider and wifi is available
so just want to check if global internet cut instantly
Without "filling in all the blanks" ─ if you can log on to the NTP server and get the time then you have thereby determined your internet status.
The "global internet" has massive redundancy. Thats why is called a "web" To perform any kind of test you would need to ping or traceroute each node.
So trying to test that is a nonsense.
For practical purposes you need to know
1: if your computer can connect to anything (ping localhost and 127.0.0.1 for ethernet)
2: if it can connect to your router (ping the router - your "default gateway" found using ipconfig)
3: if your router has a connection to your ISP (ping your ISP)
4: if the ISP can connect to the web. (ping a "nearby" and if you wish a "distant" URL) eg I can ping 58.247.206.179 which appears to be a site in Beijing.
Now that takes 200msec because the ping and response have to travel there and back. Even at the speed of light its NOT instantaneous.
Even pinging your router will take SOME time.
For practical purposes its enough to ping a "nearby" site - usually google - with a single byte. On my connection that takes typically 16msec.
If your ping hangs when pinging google there is something wrong.
DId you show your code?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.