When receiving a number of messages, string might include Data from the last /old String
This commit is contained in:
@@ -265,11 +265,13 @@ bool gatewayTransportAvailable()
|
|||||||
//debug(PSTR("UDP packet available. Size:%d\n"), packet_size);
|
//debug(PSTR("UDP packet available. Size:%d\n"), packet_size);
|
||||||
#if defined(MY_GATEWAY_ESP8266)
|
#if defined(MY_GATEWAY_ESP8266)
|
||||||
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
|
_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);
|
debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
|
||||||
return protocolParse(_ethernetMsg, inputString[0].string);
|
return protocolParse(_ethernetMsg, inputString[0].string);
|
||||||
#else
|
#else
|
||||||
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
|
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
|
||||||
_w5100_spi_en(false);
|
_w5100_spi_en(false);
|
||||||
|
inputString.string[packet_size] = 0;
|
||||||
debug(PSTR("UDP packet received: %s\n"), inputString.string);
|
debug(PSTR("UDP packet received: %s\n"), inputString.string);
|
||||||
return protocolParse(_ethernetMsg, inputString.string);
|
return protocolParse(_ethernetMsg, inputString.string);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user