ESP32 WiFi stops working program still runs

Hi everybody,

I encountered a problem with two an ESP32s.
Both send messages via UDP to a Raspi in my local WLAN.
Both run elegantOTA.
After some hours both were no longer reachable over their IP-adress.

So I connected them to a laptop that logs all serial prints into a textfile with a terminal program.

The terminal program shows that both ESP32's are still running and are sending messages over the serial port. Sending UDP ist still executed but nothing reaches the receiver.
This means the WiFi-part does not work but the rest.

I have anothe two ESP32's running
ElegantOTA and additonally, ESPDash, and Webserial they both send UDP-messages too.
Those two run and run and run for weeks now without any problem.

Very strange. What do you recommend to look at for analysing? What would you print to the serial monitor?

Does somebody know of a somekind of WifI-Watchdog.
I mean if the ESP32 s WIfi does not work any more execute ESP.restart() ?

best regards Stefan

Usually MQTT examples have a check that the WiFi connection is still good and code to reconnect if it isn't. Do you have anything like that?

Use an expanded WiFI callback to process more WiFI messages for more info.

Issue a WiFi.disconnect() before making a WiFi connection.

I've posted lots of MQTT code that does the double check of WiFi.

The most significant reliable thing I did to keep my12 ESP32's talking to the RPi was put them on their own network and the home computers on there own network. I use the RPi as the gateway for the ESP32's to talk to the internet.