esp-tls: Failed to connnect to host (errno 113)
Posted: Thu Dec 22, 2022 12:10 am
I test http post send using wifi
I connect WIFI-A device and http post send. continuosly I try to connect WIFI-B device and http post send but it always fail.
all of wifi connection is success.
-this is error log
E (702663) esp-tls: Failed to connnect to host (errno 113)
E (702663) esp-tls: Failed to open new connection
E (702663) TRANS_SSL: Failed to open a new connection
E (702663) HTTP_CLIENT: Connection failed, sock < 0
I usu ESP-IDF V4.3.2
I need your help.
-this is my code (skip wifi connection)
I connect WIFI-A device and http post send. continuosly I try to connect WIFI-B device and http post send but it always fail.
all of wifi connection is success.
-this is error log
E (702663) esp-tls: Failed to connnect to host (errno 113)
E (702663) esp-tls: Failed to open new connection
E (702663) TRANS_SSL: Failed to open a new connection
E (702663) HTTP_CLIENT: Connection failed, sock < 0
I usu ESP-IDF V4.3.2
I need your help.
-this is my code (skip wifi connection)
- vTaskDelay(100);
- esp_http_client_config_t config = {
- .host = "log.bodyfriend.co.kr",
- .path = "/api/product/history/create",
- .transport_type = HTTP_TRANSPORT_OVER_SSL,
- .event_handler = http_event_handler,
- .cert_pem = bf_ca_pem_start,
- .timeout_ms = INT32_MAX,
- //.is_async = FALSE,
- //.buffer_size = 4096,
- };
- WIFI_Total_client = esp_http_client_init(&config);
- if(WIFI_Total_client == NULL){
- ESP_LOGI(TAG, "[%s]WIFI_Total_client is NULL", __func__);
- }else{
- ESP_LOGI(TAG, "[%s]WIFI_Total_client isn't NULL", __func__);
- }
- esp_err_t err = esp_http_client_set_method(WIFI_Total_client, HTTP_METHOD_POST);
- ESP_LOGI(TAG, "[%s]esp_http_client_set_method error code: %d", __func__, err);
- err = esp_http_client_set_header(WIFI_Total_client, "Content-Type", "application/json");
- ESP_LOGI(TAG, "[%s]esp_http_client_set_header Content-Type error code: %d", __func__, err);
- err = esp_http_client_set_header(WIFI_Total_client, "secretKey", "0a98shdfpa98h3r3r9f82h93hrjshdf8a7gsdjxv");
- ESP_LOGI(TAG, "[%s]esp_http_client_set_header secretKey error code: %d", __func__, err);
- err = esp_http_client_set_post_field(WIFI_Total_client, data, strlen(data));
- ESP_LOGI(TAG, "[%s]esp_http_client_set_post_field error code: %d, data: %s", __func__, err, data);
- esp_err_t result = ESP_FAIL;
- result = esp_http_client_perform(WIFI_Total_client);
- ESP_LOGI(TAG, "[%s]http_client_send perform: %d", __func__, result);
- if (result == ESP_OK) {
- ESP_LOGI(TAG, "[%s]HTTP POST Status = %d, content_length = %d", __func__,
- esp_http_client_get_status_code(WIFI_Total_client),
- esp_http_client_get_content_length(WIFI_Total_client));
- } else {
- ESP_LOGE(TAG, "[%s]http_client_send(\n HTTP POST request failed: %s", __func__, esp_err_to_name(result));
- }
- //esp_http_client_close(WIFI_Total_client);
- //ESP_LOGI(TAG, "[%s]esp_http_client_close error code: %d", __func__, err);
- err = esp_http_client_cleanup(WIFI_Total_client);
- ESP_LOGI(TAG, "[%s]esp_http_client_cleanup error code: %d", __func__, err);