Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of WebSocketClient by
Diff: Websocket.cpp
- Revision:
- 5:bb09d7a6c92f
- Parent:
- 4:466f90b7849a
- Child:
- 6:86e89a0369b9
--- a/Websocket.cpp Mon Aug 20 08:50:51 2012 +0000 +++ b/Websocket.cpp Wed Aug 29 13:49:48 2012 +0000 @@ -184,6 +184,12 @@ DBG("timeout ws\r\n"); return false; } + + if(!socket.is_connected()) + { + WARN("Connection was closed by server"); + return false; + } socket.set_blocking(false, 1); if (socket.receive(&opcode, 1) != 1) { @@ -262,6 +268,12 @@ int res = 0, idx = 0; for (int j = 0; j < MAX_TRY_WRITE; j++) { + + if(!socket.is_connected()) + { + WARN("Connection was closed by server"); + break; + } if ((res = socket.send_all(str + idx, len - idx)) == -1) continue;