NetworkSocketAPI

Dependencies:   DnsQuery

Dependents:   HelloWizFi250Interface

Fork of NetworkSocketAPI by NetworkSocketAPI

Revision:
115:950b19eb0f02
Parent:
105:2fd212f8da61
Child:
116:bc043343d753
--- a/TCPSocket.cpp	Wed Apr 20 11:07:19 2016 -0500
+++ b/TCPSocket.cpp	Wed Apr 20 19:05:03 2016 -0500
@@ -61,8 +61,9 @@
         }
 
         int sent = _iface->socket_send(_socket, data, size);
-        if (sent != NSAPI_ERROR_WOULD_BLOCK || !_blocking || 
-            (_timeout && timer.read_ms() > _timeout)) {
+        if (sent != NSAPI_ERROR_WOULD_BLOCK
+            || _timeout < 0
+            || timer.read_ms() > _timeout) {
             return sent;
         }
     }
@@ -79,8 +80,9 @@
         }
     
         int recv = _iface->socket_recv(_socket, data, size);
-        if (recv != NSAPI_ERROR_WOULD_BLOCK || !_blocking || 
-            (_timeout && timer.read_ms() > _timeout)) {
+        if (recv != NSAPI_ERROR_WOULD_BLOCK
+            || _timeout < 0
+            || timer.read_ms() > _timeout) {
             return recv;
         }
     }