pub unsafe extern "C" fn esp_tls_conn_new_sync(
hostname: *const c_char,
hostlen: c_int,
port: c_int,
cfg: *const esp_tls_cfg_t,
tls: *mut esp_tls_t,
) -> c_intExpand description
@brief Create a new blocking TLS/SSL connection
This function establishes a TLS/SSL connection with the specified host in blocking manner.
@param[in] hostname Hostname of the host. @param[in] hostlen Length of hostname. @param[in] port Port number of the host. @param[in] cfg TLS configuration as esp_tls_cfg_t. For a TLS connection, pass a pointer to a esp_tls_cfg_t. For a plain TCP connection, pass a pointer to a esp_tls_cfg_t with is_plain_tcp set to true. At a minimum, this pointer should be not NULL and the structure should be zero-initialized @param[in] tls Pointer to esp-tls as esp-tls handle.
@note The cfg->timeout_ms parameter controls the connection timeout: - timeout_ms > 0: The connection attempt will be aborted if it does not complete within the specified duration. - timeout_ms <= 0: No application-level timeout is applied. The connection relies on the underlying socket timeout (ESP_TLS_DEFAULT_CONN_TIMEOUT). On timeout, the function returns -1 and records ESP_ERR_ESP_TLS_CONNECTION_TIMEOUT in the error handle.
@return - -1 If connection establishment fails (including timeout). - 1 If connection establishment is successful.