Skip to content

esp_wifi_internal_tx_by_ref returns ESP_ERR_NO_MEM when a client is disconnected #25

Open
@pbruynbroeck

Description

@pbruynbroeck

In esp-idf 4.2 (https://github.com/espressif/esp-idf/tree/v4.2), I have some troubles when I send data to a wifi client in UDP: espressif/esp-idf#6852

If the client is disconnected, sendto always (or almost) return ENOMEM.

In esp-idf 4.2 , the version of esp32-wifi-lib is: https://github.com/espressif/esp32-wifi-lib/tree/8075af8. I found that the ENOMEM is the error returned by esp_wifi_internal_tx_by_ref (ESP_ERR_NO_MEM).

  • Why return ESP_ERR_NO_MEM when a client is disconnected ?

I understand that, even in UDP, as the physical layer is Wi-Fi, an ACK is required (https://en.wikipedia.org/wiki/Distributed_coordination_function). So why return a no memory error and not just a timeout or another error like that ?

As ENOMEM is always returned when the device is disconnected, it adds a lot of delay if we process like that.
(And if we don't process like that, the throughput isn't respected and we can't send all our data in time...).

  • What's is your advice to detect properly a disconnection ?

My example code is available in the esp-idf ticket: espressif/esp-idf#6852

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions