Simple websocket client
Fork of WebSocketClient by
Diff: Websocket.cpp
- Revision:
- 1:de85cd4ec77b
- Parent:
- 0:10b6eaafc2da
- Child:
- 2:b390f29fb5fa
diff -r 10b6eaafc2da -r de85cd4ec77b Websocket.cpp --- a/Websocket.cpp Fri Aug 10 11:08:44 2012 +0000 +++ b/Websocket.cpp Mon Aug 13 09:21:41 2012 +0000 @@ -52,7 +52,7 @@ bool Websocket::connect() { - char cmd[192]; + char cmd[200]; while (socket.connect(ip_domain.c_str(), atoi(port.c_str())) < 0) { printf("Unable to connect to (%s) on port (%d)\r\n", ip_domain.c_str(), atoi(port.c_str())); @@ -86,7 +86,7 @@ while(socket.receive(cmd, 1) != 1); - ret = read(cmd, 512); + ret = read(cmd, 200); if(ret < 0) { close(); @@ -103,7 +103,7 @@ { printf("Wrong answer from server, got \"%s\" instead\r\n", cmd); do{ - ret = read(cmd, 512); + ret = read(cmd, 200); if(ret < 0) { printf("Could not receive answer\r\n"); @@ -291,7 +291,6 @@ if ((res = socket.receive(str + idx, len - idx)) != -1) break; } - if (i == MAX_TRY_READ - 1 || !block) return (idx == 0) ? -1 : idx; }