Simple websocket client

Dependents:   Websocket_Ethernet_HelloWorld Websocket_Wifly_HelloWorld RPC_Wifly_HelloWorld RPC_Ethernet_HelloWorld ... more

Revision:
2:b390f29fb5fa
Parent:
1:de85cd4ec77b
Child:
3:9589afa4712e
--- a/Websocket.cpp	Mon Aug 13 09:21:41 2012 +0000
+++ b/Websocket.cpp	Mon Aug 13 09:37:35 2012 +0000
@@ -83,8 +83,6 @@
       printf("Could not send request");
       return false;
     }
-    
-    while(socket.receive(cmd, 1) != 1);
 
     ret = read(cmd, 200);
     if(ret < 0)
@@ -185,9 +183,13 @@
             return false;
         }
         
+        socket.set_blocking(false, 1);
         if (socket.receive(&opcode, 1) != 1) {
+            socket.set_blocking(false, 2000);
             return false;
         }
+        
+        socket.set_blocking(false, 2000);
 
         if (opcode == 0x81)
             break;