user37978: I have seen another similar question and I followed the answer, but I cannot get my code to work for a single client properly.
In short, one NodeMCU provides AP and a WiFi server to multiple clients. The clients are supposed to stay connected. I am testing just a single client and it succeeds to connect and server reads just the first message, whereas all the subsequent messages are not received.
The server code:
#include <ESP8266WiFi.h>

#define MAX_CLIENTS 10

IPAddress    apIP(42, 42, 42, 42);
const char *ssid = "ESP8266";
const char *password = "ESP8266Test";
WiFiServer server(80);
WiFiClient *clients[MAX_CLIENTS] = { NULL };

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_AP_STA);
  WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.begin();
}

void loop () {
  WiFiClient newClient = server.available();
  if (newClient) {
    Serial.println("new client");
    // Find the first unused space
    for (int i=0 ; i<MAX_CLIENTS ; ++i) {
      if (NULL == clients[i]) {
        clients[i] = new WiFiClient(newClient);
        break;
      }
    }
  } else {
    // Check whether each client has some data
    for (int i=0 ; i<MAX_CLIENTS ; ++i) {
      if (NULL != clients[i]) //ako ima taj client {
        if (clients[i]->available()) {
          Serial.print("client "); Serial.print(i);
          Serial.println("data received");
          digitalWrite(ledPin, LOW);
          String request = clients[i]->readStringUntil('\r');
          Serial.println(request);
        }
      }
    }
  }
}

As one can see, I'm checking incoming connections with server.available(), whereas I check if there is some data over the existing connection with clients[i]->available.
What happens is that I get only the first message from the client. The client code follows:
#include <ESP8266WiFi.h>

char ssid[] = "ESP8266";
char pass[] = "ESP8266Test";
WiFiClient client;

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.println("W");
    delay(500);
  }
  client.connect(WiFi.gatewayIP(), 80); // Connection to the server
}

void loop () {
  client.println("0.00"");
  Serial.println("0.00"");
  delay(3000);
}

I suspect that I do not understand well the Server and Client classes from ESP8266WiFi Library, but it seems poorly documented.
Please advise.

user42556: I presume you are not flushing the first data that's why only the first time your communication is happening but not after the subsequent time

37978: <p>I have seen another similar question and I followed the answer, but I cannot get my code to work for a single client properly.</p>

<p>In short, one NodeMCU provides AP and a WiFi server to multiple clients. The clients are supposed to stay connected. I am testing just a single client and it succeeds to connect and server reads just the first message, whereas all the subsequent messages are not received.</p>

<p>The server code:</p>

<pre><code>#include &lt;ESP8266WiFi.h&gt;

#define MAX_CLIENTS 10

IPAddress    apIP(42, 42, 42, 42);
const char *ssid = "ESP8266";
const char *password = "ESP8266Test";
WiFiServer server(80);
WiFiClient *clients[MAX_CLIENTS] = { NULL };

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_AP_STA);
  WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.begin();
}

void loop () {
  WiFiClient newClient = server.available();
  if (newClient) {
    Serial.println("new client");
    // Find the first unused space
    for (int i=0 ; i&lt;MAX_CLIENTS ; ++i) {
      if (NULL == clients[i]) {
        clients[i] = new WiFiClient(newClient);
        break;
      }
    }
  } else {
    // Check whether each client has some data
    for (int i=0 ; i&lt;MAX_CLIENTS ; ++i) {
      if (NULL != clients[i]) //ako ima taj client {
        if (clients[i]-&gt;available()) {
          Serial.print("client "); Serial.print(i);
          Serial.println("data received");
          digitalWrite(ledPin, LOW);
          String request = clients[i]-&gt;readStringUntil('\r');
          Serial.println(request);
        }
      }
    }
  }
}
</code></pre>

<p>As one can see, I'm checking incoming connections with <code>server.available()</code>, whereas I check if there is some data over the existing connection with <code>clients[i]-&gt;available</code>.</p>

<p>What happens is that I get only the first message from the client. The client code follows:</p>

<pre><code>#include &lt;ESP8266WiFi.h&gt;

char ssid[] = "ESP8266";
char pass[] = "ESP8266Test";
WiFiClient client;

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.println("W");
    delay(500);
  }
  client.connect(WiFi.gatewayIP(), 80); // Connection to the server
}

void loop () {
  client.println("0.00"");
  Serial.println("0.00"");
  delay(3000);
}
</code></pre>

<p>I suspect that I do not understand well the Server and Client classes from ESP8266WiFi Library, but it seems poorly documented.</p>

<p>Please advise.</p>
 42556: <p>I presume you are not flushing the first data that's why only the first time your communication is happening but not after the subsequent time</p>
