WebSocket client library

Revision:
3:9b00db719afa
Parent:
2:4a841609a3a3
Child:
4:1d3e630b8f9c
--- a/Websocket.cpp	Mon Aug 15 08:52:57 2011 +0000
+++ b/Websocket.cpp	Mon Aug 15 11:17:46 2011 +0000
@@ -130,27 +130,28 @@
 
 bool Websocket::connected()
 {
-    char cmd[30];
+    char str[10];
     
+    wait(0.25);
     if(!wifi->CmdMode())
     {
         printf("Websocket::connected: cannot enter in cmd mode\r\n");
         return false;
     }
+    wait(0.25);
     
-    //try to (re)open the connection
-    sprintf(cmd, "open %s %d\r\n", ip_domain, port);
-    if(wifi->Send(cmd, "Connected"))
-    {   
+    wifi->Send("show c\r\n", "NO");
+    wifi->read(str);
+    
+    if(str[3] == '1')
+    {
         if(!wifi->exit())
+        {
+            printf("Websocket::connected: cannot exit\r\n");
             return false;
+        }
         return true;
     }
-    else
-    {
-        wifi->exit();
-        return false;
-    }
+    return false;
         
-    
 }
\ No newline at end of file