Non-blocking Internet connection

Hi,

is there any way to achieve a non-blocking Internet connection when using 

Ethernet.begin(mac, ip);

?

If there is no connection at all, this procedure does not block, but if there IS and the IP is incorrect, the program stops at this point.

Is there a workaround?

 

Peter Bezemek
Peter Bezemek
34
| 1 1 2
Asked on 3/3/22, 12:52 PM
0
vote
1229 Views

Hi Didier,

my problem is different. Let's assume THERE IS a working Internet connection, which, after some time, stops working for whatever reason. There is an Ethernet module present, but the Ethernet.begin method blocks the running of the program because there is a problem with the Internet connection and pretty much freezes the Industruino.

Peter Bezemek
Peter Bezemek
34
| 1 1 2
Answered on 4/11/22, 8:27 PM
0
vote

OK. I would try this : Your Industruino being blocked will trigger a watchdog like Adafruit Sleepydog. When your Industruino startups, just add 1 to a retry count you will save in EEPROM right after that, then attempt your Ethernet.begin. If this one fails, the watchdog will restart your Industruino again, and your retry count in EEPROM will be 2. I would try 3 consecutive attemps, then retry only every hour. If connect goes through, just reset your retry count. This way, your process will restart once in a while until your distant site gets available again. Hope this helps, Didier, DG2R

Didier DORGUIN
on 1/20/23, 10:59 AM

Hi Peter,

I think Tom covered this in : https://industruino.com/blog/our-news-1/post/ethernet-easy-plug-play-38 when he tests if the Ethernet module is present prior to sending his Ethernet.begin by testing if the SD client is present, if I remember well.

Hope this helps

Didier, DG2R

Didier DORGUIN
Didier DORGUIN
172
| 4 1 3
Answered on 4/11/22, 7:35 PM
0
vote

Hi Didier, this is not my case, so it does not help. There IS and Ethernet module and also an Internet connection which STOPS working at some point (for whatever reason). My question is whether there is something I can do in the code to prevent Industruino from waiting indefinitely at Ethernet.begin(mac, ip);

Peter Bezemek
on 11/17/22, 4:49 AM

Hi Didier,

my problem is different. Let's assume THERE IS a working Internet connection, which, after some time, stops working for whatever reason. There is an Ethernet module present, but the Ethernet.begin method blocks the running of the program because there is a problem with the Internet connection and pretty much freezes the Industruino.

Peter Bezemek
Peter Bezemek
34
| 1 1 2
Answered on 4/11/22, 8:28 PM
0
vote

Hi Peter, At this point, I would use a watchdog, count the times the Industruino freezes in a row, save this in EEPROM, and when I reach a limit like 3 retries, stop retrying for, say, 10 minutes, and try again another 3-tries cycle, until it works. Not very satisfactory, but works. Didier, DG2R

Didier DORGUIN
on 6/14/22, 5:28 AM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

68 follower(s)

Stats

Asked: 3/3/22, 12:52 PM
Seen: 1229 times
Last updated: 4/11/22, 8:28 PM