Simple websocket client

Dependents:   Websocket_Ethernet_HelloWorld Websocket_Wifly_HelloWorld RPC_Wifly_HelloWorld RPC_Ethernet_HelloWorld ... more

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Mon Aug 13 09:37:35 2012 +0000
Parent:
1:de85cd4ec77b
Child:
3:9589afa4712e
Commit message:
less timeout to read the first character received

Changed in this revision

Websocket.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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;