RC

Dependents:   WizFi250_AP_HelloWorld

Fork of WizFi250Interface by DongEun Koak

Revision:
11:e52b91d1a5d5
Parent:
9:12ecb377f63f
diff -r 187e3fd24123 -r e52b91d1a5d5 Socket/TCPSocketConnection.cpp
--- a/Socket/TCPSocketConnection.cpp	Mon Jun 22 12:18:57 2015 +0000
+++ b/Socket/TCPSocketConnection.cpp	Wed Jun 24 06:25:56 2015 +0000
@@ -74,6 +74,7 @@
 {
     Timer tmr;
     int time = -1;
+    int len = 0;
 
     if(_cid < 0 || !is_connected()) return -1;
 
@@ -82,11 +83,15 @@
         tmr.start();
         while(time < _timeout)
         {
-            if(_wizfi250->readable(_cid))
-            {
-            	WIZ_DBG("receive readable : %d\r\n",_wizfi250->readable(_cid));
-              break;
-            }
+			len = _wizfi250->readable(_cid);
+			if(len == -1)
+				return len;
+			
+			if(len > 0)
+			{
+				WIZ_DBG("receive readable : %d\r\n",len);
+				break;
+			}
             time = tmr.read_ms();
         }
         if(time >= _timeout)
@@ -96,9 +101,7 @@
         }
     }
 
-    int nb_available = _wizfi250->recv(_cid, data, length);
-
-    return nb_available;
+	return _wizfi250->recv(_cid, data, length);
 }
 
 int TCPSocketConnection::receive_all(char* data, int length)