user32064: I am trying to send and receive data with the TCP server but I am not receiving data.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>

// Parametros de conexion a red WIFI.
const char* ssid = "bits";
const char* password = "12345";

// Start a TCP Server on port 5000
WiFiServer server(5000);

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid,password);
  Serial.println("");
  //Wait for connection
  while(WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
 Serial.println(WiFi.localIP()); // IP

  // Start the TCP server
  server.begin();
}

void loop() {
  TCPServer();
}

void TCPServer () {
   WiFiClient client = server.available();
    if (client) {
      Serial.println("We have a new client");
      Serial.println("Hello, client!");
        if (client.available() > 0) {
            char thisChar = client.read();
            Serial.println("We got data");
            Serial.println(thisChar);
            delay(200);
        }
    }
}

Test Capture: In the capture it is seen that the code is executed until the following instruction.
Serial.println("We have a new client");
Serial.println("Hello, client!");




user21624: You have created a TCP server. You need to connect other clients to it to start data send and receive process between them. If you just simply run this and wait, then you probably won't get anything because nobody is attempting to connect to it.

32064: <p>I am trying to send and receive data with the <strong>TCP</strong> server but I am not receiving data.</p>

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

// Parametros de conexion a red WIFI.
const char* ssid = "bits";
const char* password = "12345";

// Start a TCP Server on port 5000
WiFiServer server(5000);

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid,password);
  Serial.println("");
  //Wait for connection
  while(WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
 Serial.println(WiFi.localIP()); // IP

  // Start the TCP server
  server.begin();
}

void loop() {
  TCPServer();
}

void TCPServer () {
   WiFiClient client = server.available();
    if (client) {
      Serial.println("We have a new client");
      Serial.println("Hello, client!");
        if (client.available() &gt; 0) {
            char thisChar = client.read();
            Serial.println("We got data");
            Serial.println(thisChar);
            delay(200);
        }
    }
}
</code></pre>

<p><strong>Test Capture</strong>: In the capture it is seen that the code is executed until the following instruction.</p>

<pre><code>Serial.println("We have a new client");
Serial.println("Hello, client!");
</code></pre>

<p><a href="https://i.stack.imgur.com/TIgBT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TIgBT.png" alt="Test rec"></a></p>

<p><a href="https://i.stack.imgur.com/t1jTS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t1jTS.png" alt="Test sen"></a></p>
 21624: <p>You have created a TCP server. You need to connect other clients to it to start data send and receive process between them. If you just simply run this and wait, then you probably won't get anything because nobody is attempting to connect to it.</p>
