HI Diego,
After TCP connection is created, call the following function to do handshake. I can't get any response from HTTPS server. I checked there is no any data received on HTTPS server. Then I comment several line in tcp_output, HTTPS can get the handshake request from Https client.
But, When I tested with HTTP server, it works fine, no need to do anything in tcp_output, looks like to me, it is related to handshake function or something else, like LWIP stack function?
Please help me to fix this problem?
Thanks,
Christie
static int tcp_client_send(struct tcp_pcb *tpcb, struct client_HNS * es)
{
struct pbuf *ptr;
err_t wr_err = ERR_OK;
// uint8_t count_test;
int ret;
if ((ret = mbedtls_ssl_set_hostname(&ssl, "os.mbed.com" )) != 0 )
{
PRINTF( "\r\nfailed ! mbedtls_ssl_set_hostname returned %d", ret );
return -1;
}
// Start the TLS handshake
PRINTF("\r\nStarting the TLS handshake...");
do
{
ret = mbedtls_ssl_handshake(&ssl);
} while(ret != 0 && (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE));
if (ret < 0)
{
PRINTF("\r\nmbedtls_ssl_handshake() returned -0x%04X", -ret);
return ret;
}
PRINTF("\r\nSuccessfully completed the TLS handshake");
return wr_err;
}