SYSTEM_MODE(MANUAL);
TCPServer server = TCPServer(80);
//TCPClient client;
void setup()
{
WiFi.connect();
pinMode(D7,OUTPUT);
// Make sure your Serial Terminal app is closed before powering your device
Serial.begin(9600);
// Now open your Serial Terminal, and hit any key to continue!
//while(!Serial.available())
//Particle.proceshttps://build.particle.io/build/562c90a9bbdd36b4af0023fc#flashs();
Serial.println(WiFi.localIP());
Serial.println(WiFi.subnetMask());
Serial.println(WiFi.gatewayIP());
Serial.println(WiFi.SSID());
// start listening for clients
server.begin();
}
void loop()
{
// check for a new client to our server
TCPClient client = server.available();
if (client.connected())
{
// we got a new client
// find where the client's remote address
IPAddress clientIP = client.remoteIP();
// print the address to Serial
Serial.println(clientIP);
}
Particle.process();
digitalWrite(D7,HIGH);
Serial.println(WiFi.localIP());
Serial.println(WiFi.subnetMask());
Serial.println(WiFi.gatewayIP());
Serial.println(WiFi.SSID());
Serial.println(client.connected());
if (client.connected()) {
// echo all available bytes back to the client
while (client.available()) {
char c = client.read();
server.write(c);
Serial.print("message recieved:");
Serial.println(c);
}
} else {
// if no client is yet connected, check for a new connection
client = server.available();
}
delay(1000);
digitalWrite(D7,LOW);
delay(1000);
}
@moors7: please check this out: