UDP Woes: Is this a memory, speed or code issue?

Not sure if this is against Policy, but I will seriously PayPal someone to find this bug. I’ve tried for weeks.


  • Arduino WiFi Rev 2 creates AP. Check.
  • Second Arduino (Client) WiFi Rev 2 connects to AP. Check
  • Client sends one number every second to Server. Check.
  • After about 45 seconds, the server stops receiving data. I have to reset the Arduino, have the client reconnect, then it works again.

This can’t be any more cut and dry, the code is short so there is minimal room for error. Is the issue that the Client is too fast for the Server? I tried adding a 1 second delay in between transmissions with negative results.

Now, I do have some ESP8266’s on a FedEx truck somewhere enroute to me. But I’d rather understand this problem before I just forget about it because it’s bothering the hell out of me

void loop() {

          Udp.beginPacket(destinationIP, destinationPort); 


Please, anyone. It makes zero sense how it could work and then stop working at an arbitrary time.

Full Client Code:

#include <SPI.h>
#include <WiFiNINA.h>
#include <WiFiUdp.h>
int status = WL_IDLE_STATUS;
char ssid[] = "MyAP";       
char pass[] = "MyPWD";  
IPAddress destinationIP(192, 168, 4, 1);  
unsigned int destinationPort = 6555;    
unsigned int localPort = 9999;     
WiFiUDP Udp;

void setup() {
  // Open serial communications and wait for port to open:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:


void loop() {
          Udp.beginPacket(destinationIP, destinationPort); 



void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");

  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(" dBm");

What does the below do?


Sorry, that's an old line. Forgot it was in there. Should be ("1")

did you find the problem? ive had lots of trouble with UDP on arduino, i cant seem to get a very high number of transmissions. it just crashs as you say and you have to restart. Id assumed it was a problem in the esp32 or 8266 librries as thas what i mainly use. but maybe it more general. just seems to burst some buffer somewhere and falls over. usually after a few seconds. i now use espnow instead seems to at least be reliable.

Hey, I don't have my laptop handy with me right now as it's 3:30am haha but I can certainly try to help you with this in the morning. Have you taken a look at this link yet? It might help you out a bit.