First off, hi guys, I don't know if this is the right place to post this, correct me if I'm wrong.
I have an ESP32 with the following code which works great with netcat:
void loop(){
wfc client = server.available();
if(client){
CT = millis();
PT = CT;
Serial.println("New client");
while(client.connected() && CT - PT <= timeout){
if(client.available()){
c = client.read();
if(c == '\n'){
break;
}else if(c != '\r'){
currentLine += c;
}
}
}
if(currentLine == "reboot"){
ESP.restart();
}
Serial.println(currentLine);
currentLine = "";
c = '\0';
client.write("Message recieved\n");
Serial.println("Client disconnected");
Serial.println();
client.stop();
}
The ESP32 boots up, tells me it's address and I hit it with an echo "test" | nc 192.168.1.36 80
from a terminal and the message(test in this case) shows up in my serial monitor, it even sends back that "Message recieved"; the ESP32 also reacts to that reboot
"command".
Now my question is how do I make the app work the same way as or "incorporate" netcat?