Doubt about client.readStringUntil()
Posted: Mon Jun 19, 2017 7:56 pm
Hi, maybe this is a stupid question, but I'll do it anyway....
I am using the esp8266 in AP mode so that my table can connect to this e send a strings, these same characters should come out of the TXD pin of the EPS, the question is that I receive these characters in the serial monitor:
Messages are repeated and I need to filter the headers because the message is just "HELLO"
Can someone tell me how to correct this?
Here is my code:
I am using the esp8266 in AP mode so that my table can connect to this e send a strings, these same characters should come out of the TXD pin of the EPS, the question is that I receive these characters in the serial monitor:
GET /HELLO HTTP/1.1
GET /HELLO HTTP/1.1
Messages are repeated and I need to filter the headers because the message is just "HELLO"
Can someone tell me how to correct this?
Here is my code:
Code: Select all
void loop()
{
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Read the first line of the request
String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();
digitalWrite(LED_PIN, LOW);
delay(200);
digitalWrite(LED_PIN, HIGH);
}