Client TCP example with scket. Starting point for TLS example with wolfSSL, client-tls

Dependencies:   EthernetInterface mbed-rtos mbed

Revision:
1:81dead2c2744
Parent:
0:3827d202644b
Child:
2:f6177f2fc898
--- a/client-tcp.cpp	Mon Jul 20 07:55:35 2015 +0000
+++ b/client-tcp.cpp	Mon Jul 20 08:27:37 2015 +0000
@@ -79,7 +79,7 @@
 
     ret = getline("Message for server: ", sendBuff, MAXDATASIZE);
     printf("Send[%d]:\n%s\n", ret, sendBuff) ;
-    if ((ret = socket->send(sendBuff, sizeof(sendBuff)-1)) < 0) {
+    if ((ret = socket->send(sendBuff, strlen(sendBuff)-1)) < 0) {
         printf("Send error: %i", ret);
         return EXIT_FAILURE;
     }
@@ -102,12 +102,13 @@
 /*
  * command line argumentCount and argumentValues
  */
-int main(void)
+void net_main(const void *av)
 {
+    char server_addr[40] ;
+    char server_port[10] ;
+    
     EthernetInterface eth;
     TCPSocketConnection socket;
-    char server_addr[40] ;
-    char server_port[10] ;
 
     eth.init(); //Use DHCP
     eth.connect();
@@ -123,5 +124,12 @@
     printf("TCP Connected\n") ;
 
     ClientGreet(&socket);
-    return 0;
+    return ;
+}
+
+int main(void)
+{
+#define STACK_SIZE 24000
+    Thread t(net_main, NULL, osPriorityNormal, STACK_SIZE);
+    while(1)wait(1.0) ;
 }
\ No newline at end of file