When receiving a number of messages, string might include Data from the last /old String

This commit is contained in:
maxtox
2016-05-05 17:14:49 +02:00
parent a64c8b13a6
commit c58523ca5c
@@ -265,11 +265,13 @@ bool gatewayTransportAvailable()
//debug(PSTR("UDP packet available. Size:%d\n"), packet_size);
#if defined(MY_GATEWAY_ESP8266)
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
inputString[0].string[packet_size] = 0;
debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
return protocolParse(_ethernetMsg, inputString[0].string);
#else
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
_w5100_spi_en(false);
inputString.string[packet_size] = 0;
debug(PSTR("UDP packet received: %s\n"), inputString.string);
return protocolParse(_ethernetMsg, inputString.string);
#endif