ESP http and internet disconnection error behaviour question
Posted: Wed Sep 25, 2019 2:05 am
Hi,
What happens if there is a Wi-Fi disconnection event (eg: Wi-Fi AP kicks device or turns off) in the middle of an HTTP transaction?
Such as this transaction:
What happens if there is a Wi-Fi disconnection event (eg: Wi-Fi AP kicks device or turns off) in the middle of an HTTP transaction?
Such as this transaction:
Code: Select all
esp_http_client_config_t ota_check = {
.url = OTA_CHECK_URL,
.event_handler = _http_event_handler,
.cert_pem = (char *)server_cert_pem_start
};
esp_http_client_handle_t client = esp_http_client_init(&ota_check);
esp_err_t err = esp_http_client_perform(client);
if(err == 0) {
int statuscode = esp_http_client_get_status_code(client);
int length = esp_http_client_get_content_length(client);
esp_err_t err2 = esp_http_client_read(client, readbuffer, length);
}
esp_http_client_cleanup(client);