blabla

Fork of ESP8266Interface by ESP8266

Revision:
10:131675c17372
Parent:
4:0bcec6272784
--- a/Socket/TCPSocketServer.cpp	Fri Nov 08 21:27:08 2013 +0000
+++ b/Socket/TCPSocketServer.cpp	Tue Jun 03 18:41:15 2014 +0000
@@ -32,8 +32,28 @@
     sprintf(cmd, "set i l %d\r", port);
     if (!wifi->sendCommand(cmd, "AOK"))
         return -1;
+    
+    // save
+    if (!wifi->sendCommand("save\r", "Stor"))
+        return -1;
+    
+    // reboot
+    wifi->reboot();
+    
+    // connect the network
+    if (wifi->isDHCP()) {
+        if (!wifi->sendCommand("join\r", "DHCP=ON", NULL, 10000))
+            return -1;
+    } else {
+        if (!wifi->sendCommand("join\r", "Associated", NULL, 10000))
+            return -1;
+    }
         
+    // exit
     wifi->exit();
+    
+    wait(0.2);
+    wifi->flush();
     return 0;
 }