pub unsafe extern "C" fn esp_http_client_perform(
client: esp_http_client_handle_t,
) -> esp_err_tExpand description
@brief Invoke this function after esp_http_client_init and all the options calls are made, and will perform the
transfer as described in the options. It must be called with the same esp_http_client_handle_t as input as the esp_http_client_init call returned.
esp_http_client_perform performs the entire request in either blocking or non-blocking manner. By default, the API performs request in a blocking manner and returns when done,
or if it failed, and in non-blocking manner, it returns if EAGAIN/EWOULDBLOCK or EINPROGRESS is encountered, or if it failed. And in case of non-blocking request,
the user may call this API multiple times unless request & response is complete or there is a failure. To enable non-blocking esp_http_client_perform(), is_async member of esp_http_client_config_t
must be set while making a call to esp_http_client_init() API.
You can do any amount of calls to esp_http_client_perform while using the same esp_http_client_handle_t. The underlying connection may be kept open if the server allows it.
If you intend to transfer more than one file, you are even encouraged to do so.
esp_http_client will then attempt to reuse the same connection for the following transfers, thus making the operations faster, less CPU intense and using less network resources.
Just note that you will have to use esp_http_client_set_** between the invokes to set options for the following esp_http_client_perform.
@note You must never call this function simultaneously from two places using the same client handle.
Let the function return first before invoking it another time.
If you want parallel transfers, you must use several esp_http_client_handle_t.
This function include esp_http_client_open -> esp_http_client_write -> esp_http_client_fetch_headers -> esp_http_client_read (and option) esp_http_client_close.
@param client The esp_http_client handle
@return
- ESP_OK on successful
- ESP_FAIL on error
- ESP_ERR_HTTP_CONNECTING is timed-out before connection is made
- ESP_ERR_HTTP_WRITE_DATA is timed-out before request fully sent
- ESP_ERR_HTTP_EAGAIN is timed-out before any data was ready
- ESP_ERR_HTTP_READ_TIMEOUT if read operation times out
- ESP_ERR_HTTP_INCOMPLETE_DATA if read operation returns less data than expected
- ESP_ERR_HTTP_CONNECTION_CLOSED if server closes the connection