ESP32 - Concurrent socket MQTT + TCP

Marc-Aurele
Posts: 15
Joined: Mon Jan 07, 2019 3:48 pm

ESP32 - Concurrent socket MQTT + TCP

Postby Marc-Aurele » Thu Mar 30, 2023 8:44 am

Hello

When I'm using MQTT only, all is working fine. But when I want to open a additional TCP socket (just a TCP while I'm already connected with MQTT), I can connect and send some data but after a while, my tcp sending function returns -1 continuously (errno = 11 : EWOULDBLOCK or EAGAIN) (this line => int written = send(sock, data + (len - to_write), to_write, 0)):

Code: Select all

static int socket_send(const char *tag, const int sock, const char * data, const size_t len){
    int to_write = len;
    int error_cnt = 0;
    while (to_write > 0) {
        int written = send(sock, data + (len - to_write), to_write, 0);
        if (written < 0 && errno != EINPROGRESS && errno != EAGAIN && errno != EWOULDBLOCK) {
            log_socket_error(tag, sock, errno, "Error occurred during sending");
            printf("socket_send TIMEOUT %d\r\n",errno);
            return -1;
        } else if (written < 0) {
            printf("written %d %d\r\n",written,errno);
            vTaskDelay(pdMS_TO_TICKS(YIELD_TO_ALL_MS));
            error_cnt++;
            if (error_cnt >= 50) {
                printf("socket_send TIMEOUT %d\r\n",error_cnt);
                return -1;
            }
            //printf("error_cnt %d\r\n",error_cnt);
        } else {
            to_write -= written;
            error_cnt = 0;
        }
    }
    return len;
}
At first, I thought it was a concurrent access between the MQTT task and my TCP task, So I tried to change priority but without any success.

Has anyone seen this before. Feel free to share any suggestion.

Thank you in advance

Best regards,

Aurélien

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 - Concurrent socket MQTT + TCP

Postby ESP_Sprite » Fri Mar 31, 2023 12:15 am

That is typically expected behaviour, but specifically for a socket that is opened in non-blocking mode. You seem to expect your socket to react like it is in blocking mode. How do you open that socket, can you post code for that?

Marc-Aurele
Posts: 15
Joined: Mon Jan 07, 2019 3:48 pm

Re: ESP32 - Concurrent socket MQTT + TCP

Postby Marc-Aurele » Fri Mar 31, 2023 12:58 pm

Hello,

Thank you for the reply.
Indeed, my tcp socket seems to be configured in non blocking mode :

Code: Select all

 
    // Marking the socket as non-blocking
    int flags = fcntl(sock, F_GETFL);
    if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1) {
        log_socket_error(TAG, sock, errno, "Unable to set socket non blocking");
    }
Here is the entire code of my connection function :

Code: Select all

uint32_t tcp_client_connect(char* p_tcp_server, char* p_tcp_port) {

    struct addrinfo hints = { .ai_socktype = SOCK_STREAM };

    if (m_socket != INVALID_SOCK)
        return 0;

    int res = getaddrinfo(p_tcp_server, p_tcp_port, &hints, &m_addressInfo);
    if (res != 0 || m_addressInfo == NULL) {
        ESP_LOGE(TAG, "couldn't get hostname for `%s` "
                      "getaddrinfo() returns %d, addrinfo=%p", p_tcp_server, res, m_addressInfo);
        goto error;
    }

    // Creating client's socket
    m_socket = socket(m_addressInfo->ai_family, m_addressInfo->ai_socktype, m_addressInfo->ai_protocol);
    if (m_socket < 0) {
        log_socket_error(TAG, m_socket, errno, "Unable to create socket");
        goto error;
    }
    ESP_LOGI(TAG, "Socket created, connecting to %s:%s", p_tcp_server, p_tcp_port);

    // Marking the socket as non-blocking
    int flags = fcntl(m_socket, F_GETFL);
    if (fcntl(m_socket, F_SETFL, flags | O_NONBLOCK) == -1) {
        log_socket_error(TAG, m_socket, errno, "Unable to set socket non blocking");
    }

    if (connect(m_socket, m_addressInfo->ai_addr, m_addressInfo->ai_addrlen) != 0) {
        if (errno == EINPROGRESS) {
            ESP_LOGD(TAG, "connection in progress");
            fd_set fdset;
            FD_ZERO(&fdset);
            FD_SET(m_socket, &fdset);

            // Connection in progress -> have to wait until the connecting socket is marked as writable, i.e. connection completes
            res = select(m_socket+1, NULL, &fdset, NULL, NULL);
            if (res < 0) {
                log_socket_error(TAG, m_socket, errno, "Error during connection: select for socket to be writable");
                goto error;
            } else if (res == 0) {
                log_socket_error(TAG, m_socket, errno, "Connection timeout: select for socket to be writable");
                goto error;
            } else {
                int sockerr;
                socklen_t len = (socklen_t)sizeof(int);

                if (getsockopt(m_socket, SOL_SOCKET, SO_ERROR, (void*)(&sockerr), &len) < 0) {
                    log_socket_error(TAG, m_socket, errno, "Error when getting socket error using getsockopt()");
                    goto error;
                }
                if (sockerr) {
                    log_socket_error(TAG, m_socket, sockerr, "Connection error");
                    goto error;
                }
            }
        } else {
            log_socket_error(TAG, m_socket, errno, "Socket is unable to connect");
            goto error;
        }
    }

    return 0;

error:
    if (m_socket != INVALID_SOCK) {
        close(m_socket);
        m_socket = INVALID_SOCK;
    }
    free(m_addressInfo);
    return 1;
}

Marc-Aurele
Posts: 15
Joined: Mon Jan 07, 2019 3:48 pm

Re: ESP32 - Concurrent socket MQTT + TCP

Postby Marc-Aurele » Fri Mar 31, 2023 7:58 pm

Here is the send function :

Code: Select all

static int socket_send(const char *tag, const int sock, const char * data, const size_t len){
    int to_write = len;
    int error_cnt = 0;
    while (to_write > 0) {
        int written = send(sock, data + (len - to_write), to_write, 0);
        if (written < 0 && errno != EINPROGRESS && errno != EAGAIN && errno != EWOULDBLOCK) {
            log_socket_error(tag, sock, errno, "Error occurred during sending");
            printf("socket_send TIMEOUT %d\r\n",errno);
            return -1;
        } else if (written < 0) {
            printf("written %d %d\r\n",written,errno);
            vTaskDelay(pdMS_TO_TICKS(YIELD_TO_ALL_MS));
            error_cnt++;
            if (error_cnt >= 50) {
                printf("socket_send TIMEOUT %d\r\n",error_cnt);
                return -1;
            }
            //printf("error_cnt %d\r\n",error_cnt);
        } else {
            to_write -= written;
            error_cnt = 0;
        }
    }
    return len;
}
What I don't understand is that I have a "vTaskDelay" when an EWOULDBLOCK or EAGAIN is raised, so it should let the previous buffer to be sent ? And next retry should succeed ... but it doesn't !

Marc-Aurele
Posts: 15
Joined: Mon Jan 07, 2019 3:48 pm

Re: ESP32 - Concurrent socket MQTT + TCP

Postby Marc-Aurele » Fri Mar 31, 2023 8:19 pm

Here is some log when the issue occurs (with LWIP debug activated)
  1. [22:13:51:499] <0x1b>[0;32mI (34566) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  2. [22:13:51:505] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  3. [22:13:51:510] lwip_send(60) err=0 written=600␍␊
  4. [22:13:51:510] <0x1b>[0;32mI (34576) TCP_IP: Written: 600<0x1b>[0m␍␊
  5. [22:13:51:515] <0x1b>[0;32mI (34576) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  6. [22:13:51:521] <0x1b>[0;32mI (34586) NimBLE: att_handle=60 len=3␍␊
  7. [22:13:51:524] <0x1b>[0m␍␊
  8. [22:13:51:601] <0x1b>[0;32mI (34676) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  9. [22:13:51:606] <0x1b>[0m␍␊
  10. [22:13:51:606] data_sent 600␍␍␊
  11. [22:13:51:606] data_sent 600␍␍␊
  12. [22:13:51:606] <0x1b>[0;32mI (34686) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  13. [22:13:51:618] <0x1b>[0;32mI (34686) NimBLE: att_handle=60 len=3␍␊
  14. [22:13:51:618] <0x1b>[0m␍␊
  15. [22:13:51:649] lwip_select: timeout expired␍␊
  16. [22:13:51:649] lwip_select(60, 0x3fcd56c0, 0x0, 0x3fcd56c8, tvsec=0 tvusec=0)␍␊
  17. [22:13:51:659] lwip_select: no timeout, returning 0␍␊
  18. [22:13:51:659] lwip_select(60, 0x3fcd5730, 0x0, 0x3fcd5738, tvsec=1 tvusec=0)␍␊
  19. [22:13:51:701] <0x1b>[0;32mI (34776) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  20. [22:13:51:706] <0x1b>[0m␍␊
  21. [22:13:51:706] <0x1b>[0;32mI (34776) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  22. [22:13:51:713] <0x1b>[0m␍␊
  23. [22:13:51:713] <0x1b>[0;32mI (34776) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  24. [22:13:51:723] <0x1b>[0m␍␊
  25. [22:13:51:723] <0x1b>[0;32mI (34786) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  26. [22:13:51:730] <0x1b>[0m␍␊
  27. [22:13:51:730] <0x1b>[0;32mI (34796) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  28. [22:13:51:740] <0x1b>[0m␍␊
  29. [22:13:51:740] <0x1b>[0;32mI (34806) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  30. [22:13:51:745] <0x1b>[0m␍␊
  31. [22:13:51:745] m_data_buffer_len 600␍␍␊
  32. [22:13:51:750] <0x1b>[0;32mI (34816) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  33. [22:13:51:756] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  34. [22:13:51:762] lwip_send(60) err=0 written=600␍␊
  35. [22:13:51:762] <0x1b>[0;32mI (34826) TCP_IP: Written: 600<0x1b>[0m␍␊
  36. [22:13:51:767] <0x1b>[0;32mI (34826) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  37. [22:13:51:773] <0x1b>[0;32mI (34836) NimBLE: att_handle=60 len=3␍␊
  38. [22:13:51:776] <0x1b>[0m␍␊
  39. [22:13:51:851] <0x1b>[0;32mI (34926) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  40. [22:13:51:856] <0x1b>[0m␍␊
  41. [22:13:51:856] data_sent 1200␍␍␊
  42. [22:13:51:856] data_sent 1200␍␍␊
  43. [22:13:51:856] <0x1b>[0;32mI (34936) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  44. [22:13:51:869] <0x1b>[0;32mI (34936) NimBLE: att_handle=60 len=3␍␊
  45. [22:13:51:869] <0x1b>[0m␍␊
  46. [22:13:52:001] <0x1b>[0;32mI (35076) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  47. [22:13:52:006] <0x1b>[0m␍␊
  48. [22:13:52:006] <0x1b>[0;32mI (35076) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  49. [22:13:52:017] <0x1b>[0m␍␊
  50. [22:13:52:017] <0x1b>[0;32mI (35076) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  51. [22:13:52:028] <0x1b>[0m␍␊
  52. [22:13:52:028] <0x1b>[0;32mI (35086) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  53. [22:13:52:028] <0x1b>[0m␍␊
  54. [22:13:52:028] <0x1b>[0;32mI (35096) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  55. [22:13:52:041] <0x1b>[0m␍␊
  56. [22:13:52:041] <0x1b>[0;32mI (35106) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  57. [22:13:52:050] <0x1b>[0m␍␊
  58. [22:13:52:050] m_data_buffer_len 600␍␍␊
  59. [22:13:52:055] <0x1b>[0;32mI (35116) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  60. [22:13:52:059] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  61. [22:13:52:063] lwip_send(60) err=0 written=600␍␊
  62. [22:13:52:063] <0x1b>[0;32mI (35126) TCP_IP: Written: 600<0x1b>[0m␍␊
  63. [22:13:52:067] <0x1b>[0;32mI (35126) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  64. [22:13:52:073] <0x1b>[0;32mI (35136) NimBLE: att_handle=60 len=3␍␊
  65. [22:13:52:076] <0x1b>[0m␍␊
  66. [22:13:52:201] <0x1b>[0;32mI (35276) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  67. [22:13:52:206] <0x1b>[0m␍␊
  68. [22:13:52:206] data_sent 1800␍␍␊
  69. [22:13:52:206] data_sent 1800␍␍␊
  70. [22:13:52:206] <0x1b>[0;32mI (35286) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  71. [22:13:52:218] <0x1b>[0;32mI (35286) NimBLE: att_handle=60 len=3␍␊
  72. [22:13:52:218] <0x1b>[0m␍␊
  73. [22:13:52:301] <0x1b>[0;32mI (35376) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  74. [22:13:52:306] <0x1b>[0m␍␊
  75. [22:13:52:306] <0x1b>[0;32mI (35376) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  76. [22:13:52:317] <0x1b>[0m␍␊
  77. [22:13:52:317] <0x1b>[0;32mI (35376) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  78. [22:13:52:328] <0x1b>[0m␍␊
  79. [22:13:52:328] <0x1b>[0;32mI (35386) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  80. [22:13:52:328] <0x1b>[0m␍␊
  81. [22:13:52:328] <0x1b>[0;32mI (35396) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  82. [22:13:52:340] <0x1b>[0m␍␊
  83. [22:13:52:340] <0x1b>[0;32mI (35406) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  84. [22:13:52:347] <0x1b>[0m␍␊
  85. [22:13:52:347] m_data_buffer_len 600␍␍␊
  86. [22:13:52:352] <0x1b>[0;32mI (35416) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  87. [22:13:52:356] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  88. [22:13:52:362] lwip_send(60) err=0 written=600␍␊
  89. [22:13:52:362] <0x1b>[0;32mI (35426) TCP_IP: Written: 600<0x1b>[0m␍␊
  90. [22:13:52:367] <0x1b>[0;32mI (35426) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  91. [22:13:52:373] <0x1b>[0;32mI (35436) NimBLE: att_handle=60 len=3␍␊
  92. [22:13:52:375] <0x1b>[0m␍␊
  93. [22:13:52:451] <0x1b>[0;32mI (35526) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  94. [22:13:52:456] <0x1b>[0m␍␊
  95. [22:13:52:456] data_sent 2400␍␍␊
  96. [22:13:52:456] data_sent 2400␍␍␊
  97. [22:13:52:456] <0x1b>[0;32mI (35536) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  98. [22:13:52:468] <0x1b>[0;32mI (35536) NimBLE: att_handle=60 len=3␍␊
  99. [22:13:52:468] <0x1b>[0m␍␊
  100. [22:13:52:551] <0x1b>[0;32mI (35626) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  101. [22:13:52:556] <0x1b>[0m␍␊
  102. [22:13:52:556] <0x1b>[0;32mI (35626) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  103. [22:13:52:567] <0x1b>[0m␍␊
  104. [22:13:52:567] <0x1b>[0;32mI (35626) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  105. [22:13:52:578] <0x1b>[0m␍␊
  106. [22:13:52:578] <0x1b>[0;32mI (35636) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  107. [22:13:52:578] <0x1b>[0m␍␊
  108. [22:13:52:578] <0x1b>[0;32mI (35646) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  109. [22:13:52:590] <0x1b>[0m␍␊
  110. [22:13:52:600] <0x1b>[0;32mI (35676) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  111. [22:13:52:606] <0x1b>[0m␍␊
  112. [22:13:52:606] m_data_buffer_len 600␍␍␊
  113. [22:13:52:606] <0x1b>[0;32mI (35676) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  114. [22:13:52:611] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  115. [22:13:52:617] lwip_send(60) err=0 written=600␍␊
  116. [22:13:52:622] <0x1b>[0;32mI (35686) TCP_IP: Written: 600<0x1b>[0m␍␊
  117. [22:13:52:622] <0x1b>[0;32mI (35686) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  118. [22:13:52:628] <0x1b>[0;32mI (35696) NimBLE: att_handle=60 len=3␍␊
  119. [22:13:52:634] <0x1b>[0m␍␊
  120. [22:13:52:659] lwip_select: timeout expired␍␊
  121. [22:13:52:659] lwip_select(60, 0x3fcd56c0, 0x0, 0x3fcd56c8, tvsec=0 tvusec=0)␍␊
  122. [22:13:52:664] lwip_select: no timeout, returning 0␍␊
  123. [22:13:52:669] lwip_select(60, 0x3fcd5730, 0x0, 0x3fcd5738, tvsec=1 tvusec=0)␍␊
  124. [22:13:52:701] <0x1b>[0;32mI (35776) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  125. [22:13:52:706] <0x1b>[0m␍␊
  126. [22:13:52:706] data_sent 3000␍␍␊
  127. [22:13:52:706] data_sent 3000␍␍␊
  128. [22:13:52:706] <0x1b>[0;32mI (35786) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  129. [22:13:52:712] <0x1b>[0;32mI (35786) NimBLE: att_handle=60 len=3␍␊
  130. [22:13:52:718] <0x1b>[0m␍␊
  131. [22:13:52:801] <0x1b>[0;32mI (35876) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  132. [22:13:52:806] <0x1b>[0m␍␊
  133. [22:13:52:806] <0x1b>[0;32mI (35876) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  134. [22:13:52:811] <0x1b>[0m␍␊
  135. [22:13:52:811] <0x1b>[0;32mI (35876) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  136. [22:13:52:823] <0x1b>[0m␍␊
  137. [22:13:52:823] <0x1b>[0;32mI (35886) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  138. [22:13:52:828] <0x1b>[0m␍␊
  139. [22:13:52:828] <0x1b>[0;32mI (35896) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  140. [22:13:52:839] <0x1b>[0m␍␊
  141. [22:13:52:839] <0x1b>[0;32mI (35906) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  142. [22:13:52:845] <0x1b>[0m␍␊
  143. [22:13:52:845] m_data_buffer_len 600␍␍␊
  144. [22:13:52:850] <0x1b>[0;32mI (35916) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  145. [22:13:52:856] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  146. [22:13:52:861] lwip_send(60) err=0 written=600␍␊
  147. [22:13:52:861] <0x1b>[0;32mI (35926) TCP_IP: Written: 600<0x1b>[0m␍␊
  148. [22:13:52:867] <0x1b>[0;32mI (35926) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  149. [22:13:52:873] <0x1b>[0;32mI (35936) NimBLE: att_handle=60 len=3␍␊
  150. [22:13:52:877] <0x1b>[0m␍␊
  151. [22:13:52:951] <0x1b>[0;32mI (36026) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  152. [22:13:52:956] <0x1b>[0m␍␊
  153. [22:13:52:956] data_sent 3600␍␍␊
  154. [22:13:52:956] data_sent 3600␍␍␊
  155. [22:13:52:956] <0x1b>[0;32mI (36036) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  156. [22:13:52:969] <0x1b>[0;32mI (36036) NimBLE: att_handle=60 len=3␍␊
  157. [22:13:52:969] <0x1b>[0m␍␊
  158. [22:13:53:051] <0x1b>[0;32mI (36126) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  159. [22:13:53:056] <0x1b>[0m␍␊
  160. [22:13:53:056] <0x1b>[0;32mI (36126) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  161. [22:13:53:069] <0x1b>[0m␍␊
  162. [22:13:53:069] <0x1b>[0;32mI (36126) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  163. [22:13:53:080] <0x1b>[0m␍␊
  164. [22:13:53:080] <0x1b>[0;32mI (36136) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  165. [22:13:53:080] <0x1b>[0m␍␊
  166. [22:13:53:080] <0x1b>[0;32mI (36146) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  167. [22:13:53:092] <0x1b>[0m␍␊
  168. [22:13:53:092] <0x1b>[0;32mI (36156) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  169. [22:13:53:099] <0x1b>[0m␍␊
  170. [22:13:53:099] m_data_buffer_len 600␍␍␊
  171. [22:13:53:104] <0x1b>[0;32mI (36166) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  172. [22:13:53:107] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  173. [22:13:53:111] lwip_send(60) err=0 written=600␍␊
  174. [22:13:53:111] <0x1b>[0;32mI (36176) TCP_IP: Written: 600<0x1b>[0m␍␊
  175. [22:13:53:117] <0x1b>[0;32mI (36176) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  176. [22:13:53:123] <0x1b>[0;32mI (36186) NimBLE: att_handle=60 len=3␍␊
  177. [22:13:53:125] <0x1b>[0m␍␊
  178. [22:13:53:201] <0x1b>[0;32mI (36276) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  179. [22:13:53:206] <0x1b>[0m␍␊
  180. [22:13:53:206] data_sent 4200␍␍␊
  181. [22:13:53:206] data_sent 4200␍␍␊
  182. [22:13:53:206] <0x1b>[0;32mI (36286) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  183. [22:13:53:217] <0x1b>[0;32mI (36286) NimBLE: att_handle=60 len=3␍␊
  184. [22:13:53:226] <0x1b>[0m␍␊
  185. [22:13:53:301] <0x1b>[0;32mI (36376) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  186. [22:13:53:306] <0x1b>[0m␍␊
  187. [22:13:53:306] <0x1b>[0;32mI (36376) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  188. [22:13:53:317] <0x1b>[0m␍␊
  189. [22:13:53:317] <0x1b>[0;32mI (36376) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  190. [22:13:53:328] <0x1b>[0m␍␊
  191. [22:13:53:328] <0x1b>[0;32mI (36386) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  192. [22:13:53:328] <0x1b>[0m␍␊
  193. [22:13:53:328] <0x1b>[0;32mI (36396) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  194. [22:13:53:340] <0x1b>[0m␍␊
  195. [22:13:53:340] <0x1b>[0;32mI (36406) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  196. [22:13:53:350] <0x1b>[0m␍␊
  197. [22:13:53:350] m_data_buffer_len 600␍␍␊
  198. [22:13:53:356] <0x1b>[0;32mI (36416) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  199. [22:13:53:356] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  200. [22:13:53:361] lwip_send(60) err=0 written=600␍␊
  201. [22:13:53:361] <0x1b>[0;32mI (36426) TCP_IP: Written: 600<0x1b>[0m␍␊
  202. [22:13:53:367] <0x1b>[0;32mI (36426) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  203. [22:13:53:373] <0x1b>[0;32mI (36436) NimBLE: att_handle=60 len=3␍␊
  204. [22:13:53:376] <0x1b>[0m␍␊
  205. [22:13:53:451] <0x1b>[0;32mI (36526) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  206. [22:13:53:456] <0x1b>[0m␍␊
  207. [22:13:53:456] data_sent 4800␍␍␊
  208. [22:13:53:456] data_sent 4800␍␍␊
  209. [22:13:53:456] <0x1b>[0;32mI (36536) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  210. [22:13:53:469] <0x1b>[0;32mI (36536) NimBLE: att_handle=60 len=3␍␊
  211. [22:13:53:469] <0x1b>[0m␍␊
  212. [22:13:53:551] <0x1b>[0;32mI (36626) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  213. [22:13:53:556] <0x1b>[0m␍␊
  214. [22:13:53:556] <0x1b>[0;32mI (36626) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  215. [22:13:53:568] <0x1b>[0m␍␊
  216. [22:13:53:568] <0x1b>[0;32mI (36626) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  217. [22:13:53:579] <0x1b>[0m␍␊
  218. [22:13:53:579] <0x1b>[0;32mI (36636) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  219. [22:13:53:579] <0x1b>[0m␍␊
  220. [22:13:53:579] <0x1b>[0;32mI (36646) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  221. [22:13:53:591] <0x1b>[0m␍␊
  222. [22:13:53:591] <0x1b>[0;32mI (36656) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  223. [22:13:53:600] <0x1b>[0m␍␊
  224. [22:13:53:600] m_data_buffer_len 600␍␍␊
  225. [22:13:53:605] <0x1b>[0;32mI (36666) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  226. [22:13:53:609] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  227. [22:13:53:613] lwip_send(60) err=0 written=600␍␊
  228. [22:13:53:613] <0x1b>[0;32mI (36676) TCP_IP: Written: 600<0x1b>[0m␍␊
  229. [22:13:53:617] <0x1b>[0;32mI (36676) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  230. [22:13:53:623] <0x1b>[0;32mI (36686) NimBLE: att_handle=60 len=3␍␊
  231. [22:13:53:626] <0x1b>[0m␍␊
  232. [22:13:53:669] lwip_select: timeout expired␍␊
  233. [22:13:53:669] lwip_select(60, 0x3fcd56c0, 0x0, 0x3fcd56c8, tvsec=0 tvusec=0)␍␊
  234. [22:13:53:674] lwip_select: no timeout, returning 0␍␊
  235. [22:13:53:679] lwip_select(60, 0x3fcd5730, 0x0, 0x3fcd5738, tvsec=1 tvusec=0)␍␊
  236. [22:13:53:751] <0x1b>[0;32mI (36826) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  237. [22:13:53:756] <0x1b>[0m␍␊
  238. [22:13:53:756] data_sent 5400␍␍␊
  239. [22:13:53:756] data_sent 5400␍␍␊
  240. [22:13:53:756] <0x1b>[0;32mI (36836) NimBLE: GATT procedure initiated: write; <0x1b>[0m␍␊
  241. [22:13:53:764] <0x1b>[0;32mI (36836) NimBLE: att_handle=60 len=3␍␊
  242. [22:13:53:769] <0x1b>[0m␍␊
  243. [22:13:53:951] <0x1b>[0;32mI (37026) NimBLE: Write complete; status=0 conn_handle=2 attr_handle=60␍␊
  244. [22:13:53:956] <0x1b>[0m␍␊
  245. [22:13:53:956] <0x1b>[0;32mI (37026) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  246. [22:13:53:969] <0x1b>[0m␍␊
  247. [22:13:53:969] <0x1b>[0;32mI (37026) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  248. [22:13:53:981] <0x1b>[0m␍␊
  249. [22:13:53:981] <0x1b>[0;32mI (37036) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=180␍␊
  250. [22:13:53:981] <0x1b>[0m␍␊
  251. [22:13:53:981] <0x1b>[0;32mI (37046) NimBLE: received notification; conn_handle=2 attr_handle=62 attr_len=60␍␊
  252. [22:13:53:993] <0x1b>[0m␍␊
  253. [22:13:53:993] <0x1b>[0;32mI (37056) NimBLE: received notification; conn_handle=2 attr_handle=65 attr_len=1␍␊
  254. [22:13:54:002] <0x1b>[0m␍␊
  255. [22:13:54:002] m_data_buffer_len 600␍␍␊
  256. [22:13:54:002] <0x1b>[0;32mI (37066) TCP_IP: Client sends data to the server...<0x1b>[0m␍␊
  257. [22:13:54:007] lwip_send(60, data=0x3fc97168, size=600, flags=0x0)␍␊
  258. [22:13:54:011] lwip_send(60) err=0 written=344␍␊
  259. [22:13:54:011] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  260. [22:13:54:017] lwip_send(60) err=-7 written=0␍␊
  261. [22:13:54:017] written -1 11␍␍␊
  262. [22:13:54:109] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  263. [22:13:54:109] lwip_send(60) err=-7 written=0␍␊
  264. [22:13:54:119] written -1 11␍␍␊
  265. [22:13:54:209] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  266. [22:13:54:209] lwip_send(60) err=-7 written=0␍␊
  267. [22:13:54:219] written -1 11␍␍␊
  268. [22:13:54:309] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  269. [22:13:54:309] lwip_send(60) err=-7 written=0␍␊
  270. [22:13:54:319] written -1 11␍␍␊
  271. [22:13:54:409] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  272. [22:13:54:409] lwip_send(60) err=-7 written=0␍␊
  273. [22:13:54:419] written -1 11␍␍␊
  274. [22:13:54:509] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  275. [22:13:54:509] lwip_send(60) err=-7 written=0␍␊
  276. [22:13:54:519] written -1 11␍␍␊
  277. [22:13:54:609] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  278. [22:13:54:609] lwip_send(60) err=-7 written=0␍␊
  279. [22:13:54:619] written -1 11␍␍␊
  280. [22:13:54:678] lwip_select: timeout expired␍␊
  281. [22:13:54:678] lwip_select(60, 0x3fcd56c0, 0x0, 0x3fcd56c8, tvsec=0 tvusec=0)␍␊
  282. [22:13:54:688] lwip_select: no timeout, returning 0␍␊
  283. [22:13:54:699] lwip_select(60, 0x3fcd5730, 0x0, 0x3fcd5738, tvsec=1 tvusec=0)␍␊
  284. [22:13:54:709] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  285. [22:13:54:709] lwip_send(60) err=-7 written=0␍␊
  286. [22:13:54:719] written -1 11␍␍␊
  287. [22:13:54:809] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  288. [22:13:54:809] lwip_send(60) err=-7 written=0␍␊
  289. [22:13:54:819] written -1 11␍␍␊
  290. [22:13:54:909] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  291. [22:13:54:909] lwip_send(60) err=-7 written=0␍␊
  292. [22:13:54:919] written -1 11␍␍␊
  293. [22:13:55:008] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  294. [22:13:55:008] lwip_send(60) err=-7 written=0␍␊
  295. [22:13:55:013] written -1 11␍␍␊
  296. [22:13:55:108] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  297. [22:13:55:108] lwip_send(60) err=-7 written=0␍␊
  298. [22:13:55:117] written -1 11␍␍␊
  299. [22:13:55:209] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  300. [22:13:55:209] lwip_send(60) err=-7 written=0␍␊
  301. [22:13:55:219] written -1 11␍␍␊
  302. [22:13:55:309] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  303. [22:13:55:309] lwip_send(60) err=-7 written=0␍␊
  304. [22:13:55:319] written -1 11␍␍␊
  305. [22:13:55:409] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  306. [22:13:55:409] lwip_send(60) err=-7 written=0␍␊
  307. [22:13:55:419] written -1 11␍␍␊
  308. [22:13:55:509] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  309. [22:13:55:509] lwip_send(60) err=-7 written=0␍␊
  310. [22:13:55:519] written -1 11␍␍␊
  311. [22:13:55:609] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  312. [22:13:55:609] lwip_send(60) err=-7 written=0␍␊
  313. [22:13:55:618] written -1 11␍␍␊
  314. [22:13:55:689] lwip_select: timeout expired␍␊
  315. [22:13:55:689] lwip_select(60, 0x3fcd56c0, 0x0, 0x3fcd56c8, tvsec=0 tvusec=0)␍␊
  316. [22:13:55:699] lwip_select: no timeout, returning 0␍␊
  317. [22:13:55:708] lwip_select(60, 0x3fcd5730, 0x0, 0x3fcd5738, tvsec=1 tvusec=0)␍␊
  318. [22:13:55:717] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  319. [22:13:55:717] lwip_send(60) err=-7 written=0␍␊
  320. [22:13:55:717] written -1 11␍␍␊
  321. [22:13:55:809] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  322. [22:13:55:809] lwip_send(60) err=-7 written=0␍␊
  323. [22:13:55:819] written -1 11␍␍␊
  324. [22:13:55:909] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  325. [22:13:55:909] lwip_send(60) err=-7 written=0␍␊
  326. [22:13:55:919] written -1 11␍␍␊
  327. [22:13:56:009] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  328. [22:13:56:009] lwip_send(60) err=-7 written=0␍␊
  329. [22:13:56:018] written -1 11␍␍␊
  330. [22:13:56:109] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  331. [22:13:56:109] lwip_send(60) err=-7 written=0␍␊
  332. [22:13:56:118] written -1 11␍␍␊
  333. [22:13:56:209] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  334. [22:13:56:209] lwip_send(60) err=-7 written=0␍␊
  335. [22:13:56:219] written -1 11␍␍␊
  336. [22:13:56:309] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  337. [22:13:56:309] lwip_send(60) err=-7 written=0␍␊
  338. [22:13:56:319] written -1 11␍␍␊
  339. [22:13:56:409] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  340. [22:13:56:409] lwip_send(60) err=-7 written=0␍␊
  341. [22:13:56:419] written -1 11␍␍␊
  342. [22:13:56:509] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  343. [22:13:56:509] lwip_send(60) err=-7 written=0␍␊
  344. [22:13:56:519] written -1 11␍␍␊
  345. [22:13:56:609] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  346. [22:13:56:609] lwip_send(60) err=-7 written=0␍␊
  347. [22:13:56:619] written -1 11␍␍␊
  348. [22:13:56:698] lwip_select: timeout expired␍␊
  349. [22:13:56:698] lwip_select(60, 0x3fcd56c0, 0x0, 0x3fcd56c8, tvsec=0 tvusec=0)␍␊
  350. [22:13:56:708] lwip_select: no timeout, returning 0␍␊
  351. [22:13:56:717] lwip_select(60, 0x3fcd5730, 0x0, 0x3fcd5738, tvsec=1 tvusec=0)␍␊
  352. [22:13:56:717] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  353. [22:13:56:717] lwip_send(60) err=-7 written=0␍␊
  354. [22:13:56:728] written -1 11␍␍␊
  355. [22:13:56:809] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  356. [22:13:56:809] lwip_send(60) err=-7 written=0␍␊
  357. [22:13:56:818] written -1 11␍␍␊
  358. [22:13:56:909] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  359. [22:13:56:909] lwip_send(60) err=-7 written=0␍␊
  360. [22:13:56:919] written -1 11␍␍␊
  361. [22:13:57:008] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  362. [22:13:57:008] lwip_send(60) err=-7 written=0␍␊
  363. [22:13:57:018] written -1 11␍␍␊
  364. [22:13:57:108] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  365. [22:13:57:108] lwip_send(60) err=-7 written=0␍␊
  366. [22:13:57:115] written -1 11␍␍␊
  367. [22:13:57:209] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  368. [22:13:57:209] lwip_send(60) err=-7 written=0␍␊
  369. [22:13:57:218] written -1 11␍␍␊
  370. [22:13:57:309] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  371. [22:13:57:309] lwip_send(60) err=-7 written=0␍␊
  372. [22:13:57:321] written -1 11␍␍␊
  373. [22:13:57:409] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  374. [22:13:57:409] lwip_send(60) err=-7 written=0␍␊
  375. [22:13:57:421] written -1 11␍␍␊
  376. [22:13:57:509] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  377. [22:13:57:509] lwip_send(60) err=-7 written=0␍␊
  378. [22:13:57:518] written -1 11␍␍␊
  379. [22:13:57:609] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  380. [22:13:57:609] lwip_send(60) err=-7 written=0␍␊
  381. [22:13:57:619] written -1 11␍␍␊
  382. [22:13:57:709] lwip_select: timeout expired␍␊
  383. [22:13:57:709] lwip_select(60, 0x3fcd56c0, 0x0, 0x3fcd56c8, tvsec=0 tvusec=0)␍␊
  384. [22:13:57:719] lwip_select: no timeout, returning 0␍␊
  385. [22:13:57:719] lwip_select(60, 0x3fcd5730, 0x0, 0x3fcd5738, tvsec=1 tvusec=0)␍␊
  386. [22:13:57:730] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  387. [22:13:57:730] lwip_send(60) err=-7 written=0␍␊
  388. [22:13:57:740] written -1 11␍␍␊
  389. [22:13:57:819] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  390. [22:13:57:819] lwip_send(60) err=-7 written=0␍␊
  391. [22:13:57:828] written -1 11␍␍␊
  392. [22:13:57:919] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  393. [22:13:57:919] lwip_send(60) err=-7 written=0␍␊
  394. [22:13:57:929] written -1 11␍␍␊
  395. [22:13:58:018] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  396. [22:13:58:018] lwip_send(60) err=-7 written=0␍␊
  397. [22:13:58:024] written -1 11␍␍␊
  398. [22:13:58:119] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  399. [22:13:58:119] lwip_send(60) err=-7 written=0␍␊
  400. [22:13:58:131] written -1 11␍␍␊
  401. [22:13:58:219] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  402. [22:13:58:219] lwip_send(60) err=-7 written=0␍␊
  403. [22:13:58:229] written -1 11␍␍␊
  404. [22:13:58:319] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  405. [22:13:58:319] lwip_send(60) err=-7 written=0␍␊
  406. [22:13:58:329] written -1 11␍␍␊
  407. [22:13:58:419] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  408. [22:13:58:419] lwip_send(60) err=-7 written=0␍␊
  409. [22:13:58:428] written -1 11␍␍␊
  410. [22:13:58:519] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  411. [22:13:58:519] lwip_send(60) err=-7 written=0␍␊
  412. [22:13:58:529] written -1 11␍␍␊
  413. [22:13:58:619] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  414. [22:13:58:619] lwip_send(60) err=-7 written=0␍␊
  415. [22:13:58:629] written -1 11␍␍␊
  416. [22:13:58:718] lwip_select: timeout expired␍␊
  417. [22:13:58:718] lwip_select(60, 0x3fcd56c0, 0x0, 0x3fcd56c8, tvsec=0 tvusec=0)␍␊
  418. [22:13:58:732] lwip_select: no timeout, returning 0␍␊
  419. [22:13:58:732] lwip_select(60, 0x3fcd5730, 0x0, 0x3fcd5738, tvsec=1 tvusec=0)␍␊
  420. [22:13:58:742] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  421. [22:13:58:742] lwip_send(60) err=-7 written=0␍␊
  422. [22:13:58:742] written -1 11␍␍␊
  423. [22:13:58:829] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  424. [22:13:58:829] lwip_send(60) err=-7 written=0␍␊
  425. [22:13:58:840] written -1 11␍␍␊
  426. [22:13:58:929] lwip_send(60, data=0x3fc972c0, size=256, flags=0x0)␍␊
  427. [22:13:58:929] lwip_send(60) err=-7 written=0␍␊
  428. [22:13:58:940] written -1 11␍␍␊
  429. [22:13:59:029] socket_send TIMEOUT 50␍␍␊
  430. [22:13:59:029] <0x1b>[0;31mE (42106) TCP_IP: Error occurred during socket_send<0x1b>[0m␍␊
  431. [22:13:59:043] lwip_close(60)␍␊
  432. [22:13:59:043] STOP SENDING 1␍␍␊

Marc-Aurele
Posts: 15
Joined: Mon Jan 07, 2019 3:48 pm

Re: ESP32 - Concurrent socket MQTT + TCP

Postby Marc-Aurele » Wed Apr 05, 2023 1:04 pm

has someone already faced something like that ? Feel free to share any idea.

Regards,

Reenis
Posts: 1
Joined: Thu Nov 14, 2024 10:52 am

Re: ESP32 - Concurrent socket MQTT + TCP

Postby Reenis » Thu Nov 14, 2024 12:02 pm

ESP_Sprite wrote:
Fri Mar 31, 2023 12:15 am
That is typically expected behaviour, but specifically for a socket that is opened in non-blocking mode. You seem to expect your socket to react like it is in blocking mode. How do you open that socket, can you post code for that?
Hi, I have a pretty similar issue. In my project based on ESP-IDF 4.3.7 running on ESP32-WROOM32I have a MQTT connection established and I want to make HTTP requests using ESP HTTP Client to the webhook. Without client messages added MQTT was working stable. Now after some time (seems to be a bit random ~5-15 minutes) MQTT handled by mbedtls has an error at lwip level, where all messages tried to be sent return error.

Code: Select all

lwip_send(54) err=-7 written=0
I get it that socket buffers may be full and this should be retried after giving a time to the tiT task (or another task that is responsible for sending data from tcpip buffers to the wifi driver) as this socket is non blocking.
Unfortunately after a few seconds later it fails to send with the same error, even lwip_select has a timeout which according to the comments in code means there is nothing to do.

Code: Select all

lwip_select(55, 0x3ffb9330, 0x0, 0x0, tvsec=0 tvusec=50000)
lwip_select: timeout expired
Due to re-connection logic in our application, after few tries we drop old connection and establish a new one and then everything works fine for some time again. It looks like TX buffer / TX mailbox is full and for unknown reason it is not consumed and forced re-connection is needed to clean up buffers.
Can you give me a hint where should I look for fix or give me a bit more details how messages from buffers are further processed and passed to wifi driver?

Who is online

Users browsing this forum: No registered users and 69 guests