Chapter 2. API Reference
• 0 If connection establishment is in progress.
• 1 If connection establishment is successful.
Parameters
• [in] url: url of host.
• [in] cfg: TLS configuration as esp_tls_cfg_t.
• [in] tls: pointer to esp-tls as esp-tls handle.
static ssize_t
esp_tls_conn_write(esp_tls_t
Write from buffer 'data'into specified tls connection.
Return
• >=0 if write operation was successful, the return value is the number of bytes actually written to the
TLS/SSL connection.
• <0 if write operation was not successful, because either an error occured or an action must be taken
by the calling process.
• ESP_TLS_ERR_SSL_WANT_READ/ ESP_TLS_ERR_SSL_WANT_WRITE. if the handshake
is incomplete and waiting for data to be available for reading. In this case this functions needs to be
called again when the underlying transport is ready for operation.
Parameters
• [in] tls: pointer to esp-tls as esp-tls handle.
• [in] data: Buffer from which data will be written.
• [in] datalen: Length of data buffer.
static ssize_t
esp_tls_conn_read(esp_tls_t
Read from specified tls connection into the buffer 'data'.
Return
• >0 if read operation was successful, the return value is the number of bytes actually read from the
TLS/SSL connection.
• 0 if read operation was not successful. The underlying connection was closed.
• <0 if read operation was not successful, because either an error occured or an action must be taken
by the calling process.
Parameters
• [in] tls: pointer to esp-tls as esp-tls handle.
• [in] data: Buffer to hold read data.
• [in] datalen: Length of data buffer.
void
esp_tls_conn_delete(esp_tls_t
Compatible version of esp_tls_conn_destroy() to close the TLS/SSL connection.
Note This API will be removed in IDFv5.0
Parameters
• [in] tls: pointer to esp-tls as esp-tls handle.
int
esp_tls_conn_destroy(esp_tls_t
Close the TLS/SSL connection and free any allocated resources.
This function should be called to close each tls connection opened with esp_tls_conn_new() or
esp_tls_conn_http_new() APIs.
Return - 0 on success
• -1 if socket error or an invalid argument
Parameters
• [in] tls: pointer to esp-tls as esp-tls handle.
ssize_t
esp_tls_get_bytes_avail(esp_tls_t
Return the number of application data bytes remaining to be read from the current record.
This API is a wrapper over mbedtls's mbedtls_ssl_get_bytes_avail() API.
Return
• -1 in case of invalid arg
• bytes available in the application data record read buffer
Parameters
Espressif Systems
*tls, const void *data, size_t datalen)
*tls, void *data, size_t datalen)
*tls)
*tls)
*tls)
523
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers