arduino_uip icon indicating copy to clipboard operation
arduino_uip copied to clipboard

TCP packet received one byte off?

Open dieterm57 opened this issue 9 years ago • 1 comments

I noticed that when I send a single byte to a TCP Client from my server, the .available() reports 1 byte received, but it is not put into my char[] rxtxBuffer:

Code:

      uint16_t dataLength = client.available();
      if(dataLength) {
        Serial.print("Read B:");Serial.println(client.read(rxtxBuffer, dataLength));
        DEBUG_PRINT(F(">> ")); DEBUG_PRINTLN((char*)rxtxBuffer);
      }

Output: receivePacket: 255 readPacket type IP, uip_len: 60 UIPClient uip_newdata, uip_len:1 Enc28J60Network_send uip_buf (uip_len): 54, packet: 2 freeing packet: 255 Read B:eatblock(1): 1 0 -> 0 0 1

If I send two bytes, only the first one gets printed: receivePacket: 255 readPacket type IP, uip_len: 60 UIPClient uip_newdata, uip_len:2 Enc28J60Network_send uip_buf (uip_len): 54, packet: 2 freeing packet: 255 Read B:eatblock(1): 1 0 -> 0 0 2

0

dieterm57 avatar Jan 30 '15 18:01 dieterm57

Same problem there. I am using pubsubclient (for MQTT communication) with arduino uip and the last byte is always chunked (it is always 0). Does anyone has solution for this problem? I can send one more byte in the packet but it would be much better if someone has a fix for that.

laszlojakab avatar Dec 16 '15 07:12 laszlojakab