Websocket client test with Vodafone USB Modems
Dependencies: WebSocketClient VodafoneUSBModem mbed mbed-rtos
Fork of VodafoneK3770WebsocketTestBeta by
Diff: main.cpp
- Revision:
- 4:0f0cd888156b
- Parent:
- 2:cc30dc616fa2
--- a/main.cpp Fri Aug 17 16:19:10 2012 +0000 +++ b/main.cpp Wed Aug 29 14:01:05 2012 +0000 @@ -15,18 +15,27 @@ return; } - ws.connect(); - - for(int i = 0; i < 500; i++) + bool c = ws.connect(); + printf("Connect result: %s\n", c?"OK":"Failed"); + + for(int i = 0; i < 10000; i++) { if(!(i%100)) - ws.send("WebSocket Hello World over the Vodafone Network!"); - + { + int ret = ws.send("WebSocket Hello World over the Vodafone Network!"); + if(ret<0) + { + printf("Timeout\n"); + ws.close(); + c = ws.connect(); + printf("Connect result: %s\n", c?"OK":"Failed"); + } + } + if (ws.read(recv)) { printf("rcv: %s\r\n", recv); } - - Thread::wait(10); + } modem.disconnect();