Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CyaSSL EthernetInterface-FRDM mbed-rtos mbed
Fork of CyaSSL-EchoClient by
Diff: main.cpp
- Revision:
- 2:dc88e0c4270e
- Parent:
- 1:0b78d1071fee
- Child:
- 3:0cab91ba32c1
--- a/main.cpp Wed Oct 08 05:04:09 2014 +0000
+++ b/main.cpp Sat Feb 07 11:39:58 2015 +0000
@@ -18,7 +18,6 @@
n = socket.receive(buf, sz) ;
if(n >= 0)return n ;
}
- printf("SocketReceive:%d/%d\n", n, sz) ;
return n ;
}
@@ -29,7 +28,7 @@
n = socket.send(buf, sz);
if(n > 0) {
return n ;
- } else printf("SocketSend:%d/%d\n", n, sz);
+ }
return n ;
}
@@ -72,9 +71,8 @@
}
printf("SSL Connected\n") ;
- char msg[] = "GET / HTTP/1.0\r\nConnection: Close\r\n\r\n" ;
- // const char msg[] = "Hello World\r\n" ;
-
+ char msg[] = "GET / HTTP/1.0\r\nConnection:close\r\n\r\n" ;
+ printf("Client Request: \n%s\n",msg) ;
if (CyaSSL_write(ssl,
/* socket.send(*/ msg, sizeof(msg)-1) != (sizeof(msg)-1))
err_sys("CyaSSL_write failed");
@@ -85,13 +83,11 @@
do {
n = CyaSSL_read(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("=== === === ===") ;
CyaSSL_free(ssl) ;
