
Example TLS client with wolfSSL, with cert
Dependencies: EthernetInterface NTPClient SDFileSystem mbed-rtos mbed wolfSSL
Revision 6:e636986882e8, committed 2015-07-24
- Comitter:
- wolfSSL
- Date:
- Fri Jul 24 04:27:38 2015 +0000
- Parent:
- 5:26b87ccd43d1
- Commit message:
- retry eth.connect
Changed in this revision
client-tls.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 26b87ccd43d1 -r e636986882e8 client-tls.cpp --- a/client-tls.cpp Tue Jul 21 22:58:30 2015 +0000 +++ b/client-tls.cpp Fri Jul 24 04:27:38 2015 +0000 @@ -158,7 +158,7 @@ printf("wolfSSL_new error.\n"); return EXIT_FAILURE; } - + wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); wolfSSL_SetIOReadCtx(ssl, (void *)socket) ; wolfSSL_SetIOWriteCtx(ssl, (void *)socket) ; @@ -169,6 +169,7 @@ } else { ret = wolfSSL_get_error(ssl, 0); printf("TLS Connect error[%d], %s\n", ret, wc_GetErrorString(ret)); + return EXIT_FAILURE; } /* frees all data before client termination */ wolfSSL_free(ssl); @@ -192,7 +193,10 @@ TCPSocketConnection socket; eth.init(); //Use DHCP - eth.connect(); + while(1) { + if(eth.connect() == 0)break ; + printf("Retry\n") ; + } printf("Client Addr: %s\n", eth.getIPAddress()); NTPClient ntp;