Vergil Cola / Mbed OS HelloMQTT Featured

Dependencies:   FP MQTTPacket

Fork of HelloMQTT by MQTT

Revision:
21:a7506c90aa84
Parent:
20:49c9daf2b0ff
Child:
22:826657a00c44
--- a/MQTTNetwork.h	Tue Jan 10 18:10:17 2017 -0600
+++ b/MQTTNetwork.h	Tue Mar 21 03:32:27 2017 +0000
@@ -5,8 +5,10 @@
 
 class MQTTNetwork {
 public:
-    MQTTNetwork(NetworkInterface* aNetwork) : network(aNetwork) {
+    MQTTNetwork(NetworkInterface* aNetwork) : network(aNetwork) 
+    {
         socket = new TCPSocket();
+        socket->set_blocking(false);
     }
 
     ~MQTTNetwork() {
@@ -14,10 +16,12 @@
     }
 
     int read(unsigned char* buffer, int len, int timeout) {
+        socket->set_timeout(timeout);
         return socket->recv(buffer, len);
     }
 
     int write(unsigned char* buffer, int len, int timeout) {
+        socket->set_timeout(timeout);
         return socket->send(buffer, len);
     }