Chat freely about anything...

User avatar
By espTroll
#39803 Hello!
I'm using client UDP application like this:

Code: Select allWiFiUDP port;
...
void setup() {
  Serial.begin(115200);
  WiFi.begin("yourssid", "yourpassword");
  port.begin(localPort);
}

void loop() {
  int packetSize = port.parsePacket();
  if (packetSize) {
    port.read(packetBuffer, packetSize);
    ...
  }
}


It works as expected expect the case of connection lost.
When WiFi is down and up again I need reconnect and continue consuming bytes.
Instead of this method parsePacket or read hangs up and never return control to the loop()

Please advice how I can interrupt and reconnect again :-)

Thanks!