From 07902414466cd5111265a6e5e234545325150fff Mon Sep 17 00:00:00 2001 From: David Cermak Date: Wed, 1 Apr 2026 10:33:23 +0200 Subject: [PATCH] fix(examples): Fix socket example incorrect len/error handling Closes https://github.com/espressif/esp-idf/issues/18134 --- .../sockets/non_blocking/main/non_blocking_socket_example.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/protocols/sockets/non_blocking/main/non_blocking_socket_example.c b/examples/protocols/sockets/non_blocking/main/non_blocking_socket_example.c index c62c54a45d..afcaf2ea5b 100644 --- a/examples/protocols/sockets/non_blocking/main/non_blocking_socket_example.c +++ b/examples/protocols/sockets/non_blocking/main/non_blocking_socket_example.c @@ -96,7 +96,10 @@ static int socket_send(const char *tag, const int sock, const char * data, const int to_write = len; while (to_write > 0) { int written = send(sock, data + (len - to_write), to_write, 0); - if (written < 0 && errno != EINPROGRESS && errno != EAGAIN && errno != EWOULDBLOCK) { + if (written < 0) { + if (errno == EINPROGRESS || errno == EAGAIN || errno == EWOULDBLOCK) { + continue; + } log_socket_error(tag, sock, errno, "Error occurred during sending"); return -1; }