ESP8266: with empty packet send returns zero if TCP, unsupported otherwise

pull/9515/head
Veijo Pesonen 2019-01-28 12:13:57 +02:00
parent daefce6bf4
commit d712568b8f
1 changed files with 5 additions and 0 deletions

View File

@ -568,6 +568,11 @@ int ESP8266Interface::socket_send(void *handle, const void *data, unsigned size)
return NSAPI_ERROR_NO_SOCKET;
}
if (!size) {
// Firmware limitation
return socket->proto == NSAPI_TCP ? 0 : NSAPI_ERROR_UNSUPPORTED;
}
unsigned long int sendStartTime = rtos::Kernel::get_ms_count();
do {
status = _esp.send(socket->id, data, size);