SNICInterface for ThingPlug Example

Dependents:   ThingPlug_WiFi_Example ThingPlug_WiFi_Example_2

Fork of SNICInterface by muRata

Revision:
48:ee7e07fb401f
Parent:
43:d80bbb12ffe6
Child:
54:cb4c105a2ad2
diff -r 69dd5911fc6a -r ee7e07fb401f Socket/TCPSocketConnection.cpp
--- a/Socket/TCPSocketConnection.cpp	Mon Feb 02 00:10:06 2015 +0000
+++ b/Socket/TCPSocketConnection.cpp	Tue Mar 31 02:48:32 2015 +0000
@@ -191,7 +191,7 @@
 
     // SNIC_SEND_FROM_SOCKET_REQ
     FUNC_OUT();
-    return 0;
+    return length;
 }
 
 int TCPSocketConnection::send_all(char *data_p, int length)
@@ -229,9 +229,17 @@
         return -1;
     }
     con_info_p->is_receive_complete = true;
-    while( con_info_p->is_received == false )
+    if( con_info_p->is_received == false )
     {
+        // Try receive
         Thread::yield();
+        
+        if( con_info_p->is_received == false )
+        {
+            // No data received.
+            FUNC_OUT();
+            return 0;
+        }        
     }
     // Get packet data from buffer for receive.
     for (i = 0; i < length; i ++) 
@@ -253,6 +261,11 @@
     return i;
 }
 
+int TCPSocketConnection::receive_all(char* data_p, int length)
+{
+    return receive( data_p, length );
+}
+
 void TCPSocketConnection::setAcceptSocket( int socket_id )
 {
     FUNC_IN();