d

Dependencies:   MQTTPacket FP

Revision:
60:f1a42823e381
Parent:
54:ff9e5c4b52d0
--- a/MQTTSocket.h	Thu Nov 02 12:12:41 2017 +0000
+++ b/MQTTSocket.h	Sun Mar 20 19:25:46 2022 +0000
@@ -22,7 +22,8 @@
         open = true;
         mysock.set_blocking(true);
         mysock.set_timeout((unsigned int)timeout);  
-        rc = mysock.connect(hostname, port);
+        SocketAddress socketAddr(hostname,port);
+        rc = mysock.connect(socketAddr);
         mysock.set_blocking(false);  // blocking timeouts seem not to work
         return rc;
     }
@@ -39,7 +40,7 @@
             if (first)
                 first = false;
             else
-                wait_ms(timeout < 100 ? timeout : 100);
+                wait_us((timeout*1000) < 100 ? (timeout*1000) : 100);
             int rc;
             if (read)
                 rc = mysock.recv((char*)buffer, len);
@@ -68,6 +69,16 @@
     {
         return common(buffer, len, timeout, true);
     }
+    
+    
+    /*int read(unsigned char* buffer, int len, int timeout)
+    {
+        mysock.set_timeout(timeout);
+        int rc = mysock.recv((char*)buffer, len);
+        mysock.set_timeout(0);
+        return rc;
+    }
+*/
 
     int write(unsigned char* buffer, int len, int timeout)
     {