ap

Dependencies:   DnsQuery

Dependents:   WizFi310_TCP_Echo_Server_Example

Fork of NetworkSocketAPI by NetworkSocketAPI

Revision:
115:950b19eb0f02
Parent:
105:2fd212f8da61
Child:
116:bc043343d753
--- a/UDPSocket.cpp	Wed Apr 20 11:07:19 2016 -0500
+++ b/UDPSocket.cpp	Wed Apr 20 19:05:03 2016 -0500
@@ -52,8 +52,9 @@
         }
     
         int sent = _iface->socket_sendto(_socket, address, 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;
         }
     }
@@ -70,8 +71,9 @@
         }
     
         int recv = _iface->socket_recvfrom(_socket, address, buffer, 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;
         }
     }