Simple websocket client

Fork of WebSocketClient by Samuel Mokrani

Files at this revision

API Documentation at this revision

Comitter:
BobMorane22
Date:
Tue Dec 05 15:05:20 2017 +0000
Parent:
7:4567996414a5
Commit message:
Premiere iteration du noeud fixe!

Changed in this revision

Websocket.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4567996414a5 -r 19f2477d83ad Websocket.cpp
--- a/Websocket.cpp	Fri Feb 08 12:33:04 2013 +0000
+++ b/Websocket.cpp	Tue Dec 05 15:05:20 2017 +0000
@@ -4,7 +4,7 @@
 #define MAX_TRY_READ 10
 
 //Debug is disabled by default
-#if 0
+#if 1
 #define DBG(x, ...) std::printf("[WebSocket : DBG]"x"\r\n", ##__VA_ARGS__); 
 #define WARN(x, ...) std::printf("[WebSocket : WARN]"x"\r\n", ##__VA_ARGS__); 
 #define ERR(x, ...) std::printf("[WebSocket : ERR]"x"\r\n", ##__VA_ARGS__); 
@@ -231,7 +231,7 @@
     char mask[4] = {0, 0, 0, 0};
     bool is_masked = false;
     Timer tmr;
-
+    //DBG("START READ")
     // read the opcode
     tmr.start();
     while (true) {
@@ -249,6 +249,7 @@
         socket.set_blocking(false, 1);
         if (socket.receive(&opcode, 1) != 1) {
             socket.set_blocking(false, 2000);
+            DBG("bad opcode?: 0x%X\r\n", opcode);
             return false;
         }