Closed kosukekurimoto closed 5 years ago
In all of my projects I'm OK with default value (10).
It makes sense to see what sock value (error code) we are looking at.
I examined the procedure where an error occurred. https://github.com/kosukekurimoto/esp32-homekit-natureremo/blob/master/main/natureremo.c
esp_http_client_perform(client);
↓ https://github.com/espressif/esp-idf/blob/master/components/esp_http_client/esp_http_client.c
if ((err = esp_http_client_connect(client)) != ESP_OK) {
if (client->is_async && err == ESP_ERR_HTTP_CONNECTING) {
return ESP_ERR_HTTP_EAGAIN;
}
return err;
}
↓ https://github.com/espressif/esp-idf/blob/master/components/esp_http_client/esp_http_client.c
if (esp_transport_connect(client->transport, client->connection_info.host, client->connection_info.port, client->timeout_ms) < 0) {
ESP_LOGE(TAG, "Connection failed, sock < 0");
return ESP_ERR_HTTP_CONNECT;
}
↓ https://github.com/espressif/esp-idf/blob/master/components/tcp_transport/transport_tcp.c
if (tcp->sock < 0) {
ESP_LOGE(TAG, "Error create socket");
return -1;
}
Well, my idea was to check the sock value which in case of error will be an error code. That way you can make sure that it is the error you think it is (which is socket leak).
Thank you very much. I appreciate the advice you gave me.
Currently I am advancing esp-homekit project to operate Nature Remo from Apple Homekit. https://github.com/kosukekurimoto/esp32-homekit-natureremo
There is a problem with this source that it is not possible to create a new socket several hours after startup.
The length of time this problem occurs depends on the LWIP setting.
Are there recommended settings?