Hello,
Yes, ESP is sending part. It sends data to server.
I am referring "https_async" from
https://github.com/espressif/esp-idf/bl ... _example.c
The example works fine with the test url in method but if I change the url to my server url with custom post data, it fails with following error,
Code: Select all
I (6203) HTTP_CLIENT: Connected to AP, begin http example
E (9033) TRANS_SSL: esp_tls_conn_read error, errno=No more processes
E (9333) esp-tls: read error :-80:
E (9333) TRANS_SSL: esp_tls_conn_read error, errno=Connection reset by peer
E (9343) HTTP_CLIENT: Error perform http request ESP_ERR_HTTP_FETCH_HEADER
I (9343) HTTP_CLIENT: Finish http example
The modified code for https_async is as below
Code: Select all
static void https_async(void)
{
esp_http_client_config_t config = {
//.url = "https://postman-echo.com/post",
.url = "https://my-server-url.com/api/Test/TestCall/",
.event_handler = _http_event_handler,
.is_async = true,
.timeout_ms = 5000,
};
esp_http_client_handle_t client = esp_http_client_init(&config);
esp_err_t err;
const char *post_data = "DATA=105";
esp_http_client_set_method(client, HTTP_METHOD_POST);
esp_http_client_set_post_field(client, post_data, strlen(post_data));
while (1) {
err = esp_http_client_perform(client);
if (err != ESP_ERR_HTTP_EAGAIN) {
break;
}
}
if (err == ESP_OK) {
ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %d",
esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client));
} else {
ESP_LOGE(TAG, "Error perform http request %s", esp_err_to_name(err));
}
esp_http_client_cleanup(client);
}
The same url works fine with Postman and I could get the response.
Appreciate any pointers on this issues.
Thanks
/Hp