As part of the study, the IP found: when receiving packets of different lengths, the received data is not correctly displayed in the serial port. To correct after the line
add this
Code:
Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);
Code:
packetBuffer[packetSize]=0;