arduino_uip
arduino_uip copied to clipboard
TCP packet received one byte off?
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
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.