Доброго дня, происходит непонятная ситуация, после получения http запроса клиент отключается от wifi
#include <ESP8266WiFi.h>
int Z = 10;
#ifndef APSSID
#define APSSID "WIFISET"
#define APPSK "1234567890"
#endif
/* Set these to your desired credentials. */
const char *ssid = APSSID;
const char *password = APPSK;
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
IPAddress ip(11, 22, 33, 44); //статический IP
IPAddress gateway(11, 22, 33, 43);
IPAddress subnet(255, 255, 255, 0);
void setup() {
Serial.begin(9600);
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid, password); // Установите в режим AP
IPAddress ip = WiFi.softAPIP(); // получить IP-адрес
Serial.println(ip);// распечатать IP-адрес
WiFi.setSleepMode(WIFI_NONE_SLEEP);
server.begin();
}
void loop() {
WiFiClient client = server.available();
if (!client) {
return;
}
Serial.print("New client: ");
Serial.println(client.remoteIP());
// Wait for the client to send data.
while (!client.available()) {
delay(1);
}
// Read information of client.
String req = client.readStringUntil('\rr');
req.replace("+", " "); // Spaces without +
req.replace(" HTTP/1.1", ""); // this delete HTTP/1.1
req.replace("GET /", ""); // this delete GET /
req.replace("act=", ""); // this delete GET /
req.replace("\rr", ""); // this delete GET /
req.replace("/", ""); // this delete GET /
Serial.print("req-");
Serial.println(req);
Z = req.toInt();
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println(""); // Important.
client.flush();
client.stop();
}
Ну так в либе сервака написано,что возвратом является объект клиента, а клиент это тот кто прислал запрос , приняв запрос http и отдав ему ответ он и стопится. Но почему клиент wifi отваливается? Клиент сервака и клиент wifi -это разные клиенты.