Tests
Dependencies: EthernetInterface WebSocketClient mbed-rtos mbed
Fork of Websocket by
Diff: main.cpp
- Revision:
- 3:45033d977233
- Parent:
- 1:1c1802ec42a2
diff -r 00da1457c871 -r 45033d977233 main.cpp --- a/main.cpp Thu Aug 23 14:11:49 2012 +0000 +++ b/main.cpp Mon Feb 13 17:48:34 2017 +0000 @@ -2,19 +2,25 @@ #include "EthernetInterface.h" #include "Websocket.h" +Serial pc(USBTX, USBRX); +static const char* mbedIp = "192.168.0.180"; //IP +static const char* mbedMask = "255.255.255.0"; // Mask +static const char* mbedGateway = "192.168.0.1"; //Gateway -int main() { +int main() +{ char recv[30]; EthernetInterface eth; - eth.init(); //Use DHCP + pc.printf("mbed connected : %d\r\n", eth.init(mbedIp, mbedMask, mbedGateway)); eth.connect(); - printf("IP Address is %s\n\r", eth.getIPAddress()); + pc.printf("IP Address is %s\r\n", eth.getIPAddress()); - Websocket ws("ws://sockets.mbed.org:443/ws/demo/wo"); - ws.connect(); + Websocket ws("ws://169.254.55.70:8080/"); + pc.printf("mbed connected to server : %d\r\n", ws.connect()); - while (1) { + while (1) + { ws.send("WebSocket Hello World over Ethernet"); wait(1.0); }