Question

Friends, i need check arduino when stoped communication with internet. What best practice for this case

https://www.google.com/search?q=i+need+check+arduino+when+stoped+communication+with+internet.+What+best+practice+for+this+case

That might make sense to Google but we need a little more to go on. What are you trying to do? What action should the Arduino (or internet) take when communication stops?

I need identify when connection with internet not run. I have ethernet (ENC28J60) and if the network not run, i want reboot arduino. The reboot code, i have.

If you lose connection to Internet, it could be for a number of reasons. How is a reboot going to fix all possible reasons?

It could be a cable fault, router fault, power fault or a particular site may be down or overloaded.

How are you determining the Internet is down?

Weedpharma

That's what he's asking: "How do I detect when the internet connection is not 'running'?"
I have no idea why he would want to reboot when connection is lost, but it is his project, not mine....

123Splat, thank's.

the devices not stay in my job place, i need reboot in minimum 20 nanos case drop internet. Reboot the nano, go avoid I go the place the reboot manual, work agility in the company

When the internet again, to restart the nano, otherwise it does not identify the network again. Sometimes he returns alone, sometimes not.

Well, you could try this: Arduino Playground - ICMP Ping Library
Ping a well known server example: forum.arduino.cc .
Or this. https://www.arduino.cc/en/Tutorial/TelnetClient Telnet a well known web server on port 80 example www.ibm.com

If you get an answer, then you have demonstrated your internet connection is OK. If not, try a restart. If that fails, start looking.

It makes sense to me to have the microcontroller reboot when you detect that it's not connected to the internet, if that's essential to it's functioning.

Especially since many of the problems that could take out the internet are something that the microcontroller has no way to control - it seems like a reasonable response for the microcontroller to keep rebooting itself (in case it is a problem with the state of software on the board) and hoping that someone has fixed whatever the problem is. What the hell else can you do if the purpose of the device is to communicate over the network and the network is down?

The recommended way to trigger a software reboot (once you determine that the connection has been lost) is using the WDT (note - if you're using Nano's or Pro Mini's, you need to bootload them as Uno's first (and refer to them as Uno when uploading to them, otherwise using the WDT to reset them will soft-brick the board (need reburn bootloader to fix) due to a bug in the Nano/Pro Mini bootloaders)

6v6gt:
Well, you could try this: Arduino Playground - HomePage
Ping a well known server example: forum.arduino.cc .
Or this. https://www.arduino.cc/en/Tutorial/TelnetClient Telnet a well known web server on port 80 example www.ibm.com

If you get an answer, then you have demonstrated your internet connection is OK. If not, try a restart. If that fails, start looking.

Friend, thanks for help.

I'm not managing to run the sample, run the error:


C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp:219: error: invalid conversion from 'uint16_t' to 'volatile uint8_t*'
C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp:219: error: initializing argument 2 of 'void W5100Class::read_data(SOCKET, volatile uint8_t*, volatile uint8_t*, uint16_t)'
C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp:229: error: invalid conversion from 'uint16_t' to 'volatile uint8_t*'
C:\Program Files\Arduino\libraries\icmp_ping\ICMPPing.cpp:229: error: initializing argument 2 of 'void W5100Class::read_data(SOCKET, volatile uint8_t*, volatile uint8_t*, uint16_t)'

But I already imported libraries to the library folder.

Friends, the version 2 is all right.

I'm verify

MorganS:
i need check arduino when stoped communication with internet. What best practice for this case - Google Search

That might make sense to Google but we need a little more to go on. What are you trying to do? What action should the Arduino (or internet) take when communication stops?

well, here ya go then ! link