ap

Dependencies:   DnsQuery

Dependents:   WizFi310_TCP_Echo_Server_Example

Fork of NetworkSocketAPI by NetworkSocketAPI

Revision:
115:950b19eb0f02
Parent:
109:5d8bd5752386
Child:
118:96627c4b83d5
--- a/Socket.h	Wed Apr 20 11:07:19 2016 -0500
+++ b/Socket.h	Wed Apr 20 19:05:03 2016 -0500
@@ -86,7 +86,10 @@
      *  blocking operations such as send/recv/accept return
      *  NSAPI_ERROR_WOULD_BLOCK if they can not continue.
      *
-     *  @param blocking True for blocking mode, false for non-blocking mode.
+     *  set_blocking(false) is equivalent to set_timeout(-1)
+     *  set_blocking(true) is equivalent to set_timeout(0)
+     *
+     *  @param blocking true for blocking mode, false for non-blocking mode.
      */
     void set_blocking(bool blocking);
     
@@ -94,11 +97,14 @@
      *
      *  Initially all sockets have unbounded timeouts. NSAPI_ERROR_WOULD_BLOCK
      *  is returned if a blocking operation takes longer than the specified
-     *  timeout. A timeout of 0 removes a timeout from the socket.
+     *  timeout. A timeout of -1 removes the timeout from the socket.
+     *
+     *  set_timeout(-1) is equivalent to set_blocking(false)
+     *  set_timeout(0) is equivalent to set_blocking(true)
      *
      *  @param timeout  Timeout in milliseconds
      */
-    void set_timeout(unsigned int timeout);
+    void set_timeout(int timeout);
 
     /*  Set stack-specific socket options
      *
@@ -166,8 +172,7 @@
 
     NetworkStack *_iface;
     void *_socket;
-    bool _blocking;
-    unsigned _timeout;
+    int _timeout;
     FunctionPointer _callback;
 };