Skip to content

ESP32 TCP Server No Data Received

DodaTech Updated 2026-06-26 1 min read

In this tutorial, you'll learn about ESP32 TCP Server No Data Received. We cover key concepts, practical examples, and best practices.

The Problem

ESP32 TCP server accepts connections but receives no data or garbled data.

Quick Fix

Wrong

WiFiServer server(80);
server.begin();
WiFiClient client = server.available();
if (client) { String s = client.readString(); }
Client connects but ESP32 reads empty string or partial data.
WiFiServer server(80);
server.begin();
void loop() {
  WiFiClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        String line = client.readStringUntil('\n");
        Serial.printf("Received: %s", line.c_str());
        client.println("ACK');
        break;
      }
    }
    client.stop();
  }
}
Received: GET / HTTP/1.1
ACK sent to client

Prevention

Use readStringUntil() with delimiter. Check available() before reading. Handle one request per loop. Close with stop(). Set timeout for slow clients.

DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.

FAQ

### How many TCP clients?

ESP32 handles 4-8 simultaneous TCP clients. Each uses ~4-8 KB heap.

What is the max TCP throughput?

ESP32 TCP throughput is about 10-15 Mbps over Wi-Fi. Use MQTT for higher-level IoT.

How to detect client disconnect?

Check connected() in loop. If false, call stop() and wait for next available().

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro