Simple Client TCP for FRDM
Dependencies: EthernetInterface-FRDM mbed-rtos mbed
Fork of CyaSSL-EchoClient by
Diff: main.cpp
- Revision:
- 4:3cd5b93387c7
- Parent:
- 2:e28e0426c0b0
- Child:
- 5:b74ac4acd827
--- a/main.cpp Sat Feb 07 09:16:13 2015 +0000 +++ b/main.cpp Sat Feb 07 11:37:42 2015 +0000 @@ -19,7 +19,6 @@ n = socket.receive(buf, sz) ; if(n >= 0)return n ; } - printf("SocketReceive:%d/%d\n", n, sz) ; return n ; } @@ -30,7 +29,7 @@ n = socket.send(buf, sz); if(n > 0) { return n ; - } else printf("SocketSend:%d/%d\n", n, sz); + } return n ; } end SSL ***/ @@ -47,8 +46,6 @@ CYASSL_METHOD* method = CyaTLSv1_2_client_method(); end SSL ***/ - - /* Initialize CyaSSL Context */ /*** SSL ctx = CyaSSL_CTX_new(method); @@ -84,7 +81,6 @@ ***/ char msg[] = "GET / HTTP/1.0\r\n\r\n" ; - // const char msg[] = "Hello World\r\n" ; if (/*** SSL CyaSSL_write(ssl, end SSL***/ socket.send(msg, sizeof(msg)-1) != (sizeof(msg)-1)) @@ -96,13 +92,11 @@ do { n = /*** SSL CyaSSL_read(ssl, end SSL ***/ socket.receive(buf, sizeof(buf)-1); - if (n >= 0) { - + if (n > 0) { buf[n] = 0; - //printf("%d,", n) ; printf("%s", buf); } else - err_sys("CyaSSL_read failed"); + break ; } while(n > 0) ; puts("=== === === ===") ; /*** SSL CyaSSL_free(ssl) ; ***/