constchar*common_name=ssl_get_cert_dn(ssl,SSL_X509_CERT_COMMON_NAME);
if(common_name){
printf("CommonName:\t\t\t%s\n",common_name);
}
display_session_id(ssl);
display_cipher(ssl);
quiet=true;
os_printf("clienthandshakeok!heapsize%d\n",system_get_free_heap_size());
x509_free(ssl->x509_ctx);
ssl->x509_ctx=NULL;
os_printf("certificatefreeok!heapsize%d\n”,system_get_free_heap_size());
10.Transmit SSL data.
uint8buf[512];
bzero(buf,sizeof(buf));
sprintf(buf,httphead,"/","iot.espressif.cn",port);
os_printf("%s\n",buf);
if(ssl_write(ssl,buf,strlen(buf)+1)<0){
ssl_free(ssl);
ssl_ctx_free(ssl_ctx);
close(client_fd);
vTaskDelay(1000/portTICK_RATE_MS);
os_printf("sendfail\n");
continue;
}
11.Receive SSL data.
while((recbytes=ssl_read(ssl,&read_buf))>=0){
if(recbytes==0){
vTaskDelay(500/portTICK_RATE_MS);
continue;
}
os_printf("%s\n",read_buf);
}
free(read_buf);
if(recbytes<0){
os_printf("ERROR:readdatafail!recbytes%d\r\n",recbytes);
ssl_free(ssl);
ssl_ctx_free(ssl_ctx);