wifly/socket interface for wifly modules
Dependents: WiFi neurGAI_WIFI thingspeak thingspeak2
Diff: Socket/TCPSocketServer.cpp
- Revision:
- 13:108340829acc
- Parent:
- 11:b912f91e3212
--- a/Socket/TCPSocketServer.cpp Fri Aug 24 13:11:20 2012 +0000 +++ b/Socket/TCPSocketServer.cpp Fri Aug 24 13:25:55 2012 +0000 @@ -23,16 +23,16 @@ // Server initialization int TCPSocketServer::bind(int port) { - // use udp auto pairing char cmd[20]; - /*if (!wifi->sendCommand("set ip proto 2\r", "AOK")) - return -1; - if (!wifi->sendCommand("set ip flags 0x07\r", "AOK")) - return -1;*/ + + // set TCP protocol wifi->setProtocol(TCP); - sprintf(cmd, "set ip local %d\r", port); + + // set local port + sprintf(cmd, "set i l %d\r", port); if (!wifi->sendCommand(cmd, "AOK")) return -1; + wifi->exit(); return 0; }