Camila_99$$
DIIDevHeads IoT Integration Server
•Created by Camila_99$$ on 8/30/2024 in #edge-networking
How to Force HTTP Requests to Timeout on ESP32 When Router Freezes?
Hello! I've had a setup running for several months now, which makes HTTP requests to several devices on home WiFi network (the router is part of a Freebox). Everything works quite well, except for certain moments when I experience "freezes" of several seconds during a request. These freezes often disappear if I restart my Freebox (and thus the router).
To avoid these freezes, I’m looking for a way to force the request to exit if it hasn’t succeeded within a second (for example).
Here is the current code of one of my HTTP requests (launched every 5 seconds from the loop of my program):
I added the line
http.setConnectTimeout(500);
, but it doesn’t seem to be of much use... Maybe using a "watchdog" that would exit the request after some time? But I’m not really sure how to do that...
So, I’m looking for all your expert advice!
Thanks 🙏🏻4 replies