Hello fellas,
I am sending udp packet from my phone (android app) to my esp32 (arduino code) which is then displayed to my PC using serial.
I have managed to get some packets sent to the esp32 and displayed on PC but it looks like that the packet size is considered to the largest packet.
example:
I send JSK ==> I receive JSK
I send MOB ==> I receive MOB
if I then send JSMB ==> I receive JSMB
now if i send back JSK ==> I receive JSKB
Why is it behaving like that?
here is the receiving code:
void loop()
{
if(connected)
{
electrical_values();
int packetSize = udp.parsePacket();
if (packetSize) {
udp.read(packetBuffer, packetSize);
Serial.println(packetBuffer);
}
//Send a packet
udp.beginPacket(udpAddress,udpPort);
String str(packetBuffer);
Packets = /*Packets + "@" +*/ packetBuffer;
udp.print(packetBuffer);
udp.endPacket();
}}}