Keep TCP connection ,when don't read TCP buffer

kiyotomo
Posts: 1
Joined: Mon Oct 24, 2022 1:08 am

Keep TCP connection ,when don't read TCP buffer

Postby kiyotomo » Mon Oct 24, 2022 3:07 am

I do TCP communication using ESP32.
This is test for my project.
ESP32 is server.
I connect to ESP32 from PC.
ESP32 keep to not read TCP buffer after be connected.
PC send to ESP32 8 times (regardless of byte length) then ESP32 don't send ack and PC disconnect ESP32.
I'd like to keep TCP connection ,when don't read TCP buffer.
What should I do?

I use Arduino IDE 2.0.0 (Arduino Core for ESP32).
Board is ESP32-PoE-ISO.

Code: Select all

#include <ETH.h>

WiFiServer server(5000, 1);
WiFiClient client;

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("\nSTART");

  WiFi.disconnect(true);
  WiFi.mode(WIFI_OFF);

  ETH.begin();

  delay(1000);
  server.begin(5000);

  while (!client.connected()) {
    if (server.hasClient()) {
      client = server.available();
      Serial.println("connected");
    }
  }
}

void loop() {
  delay(100);
}

Who is online

Users browsing this forum: No registered users and 98 guests