We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0f9e65 commit fefef0dCopy full SHA for fefef0d
components/wifi/esp8266-driver/ESP8266/ESP8266.cpp
@@ -549,7 +549,14 @@ bool ESP8266::dns_lookup(const char *name, char *ip)
549
nsapi_error_t ESP8266::send(int id, const void *data, uint32_t amount)
550
{
551
// +CIPSEND supports up to 2048 bytes at a time
552
- amount = amount > 2048 ? 2048 : amount;
+ // Data stream can be truncated
553
+ if (amount > 2048 && _sock_i[id].proto == NSAPI_TCP) {
554
+ amount = 2048;
555
+ // Datagram must stay intact
556
+ } else if (amount > 2048 && _sock_i[id].proto == NSAPI_UDP) {
557
+ tr_debug("UDP datagram maximum size is 2048");
558
+ return NSAPI_ERROR_PARAMETER;
559
+ }
560
561
//May take a second try if device is busy
562
for (unsigned i = 0; i < 2; i++) {
0 commit comments