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?
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.
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
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);
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.
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
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!
Keep Informed
About This Forum
This community is for professionals and enthusiasts of our products and services.
Read GuidelinesQuestion tools
Stats
Asked: 3/3/22, 12:52 PM |
Seen: 1188 times |
Last updated: 4/11/22, 8:28 PM |
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