0

A tcp server is established in Esp32(station mode). I accept the clients with the code below.

int sock = accept(listen_sock, (struct sockaddr *)&source_addr, &addr_len);
if (sock < 0) {
    ESP_LOGE(TAG, "Unable to accept connection: errno %d", errno);
    break;
}

When 20 tcp clients send requests to connect at the same time, 9 can connect. But in my system, 1000 clients on the field will have to connect to the esp32 server at the same time.

Although I made "Maximum active TCP Connections" and "Maximum listening TCP Connections" to 1000 in Menuconfig(LWIP->TCP), the number of connections did not change.

Only when I changed the "Max number of open sockets" in Menuconfig, I was able to increase the number of connections.

Esp32 will be connected to the network in "station" mode and create tcp server. The other 1000 esp32 will connect to this as client.

Is it possible?How should I set tcp server, if possible?

Qwe Qwe
  • 399
  • 4
  • 13
  • 1
    use more powerful server to handle 1000 connections. esp32 has 512Kb of RAM. I do not believe that 500 bytes per planned client will be enough for lwIP to support those 1000 clients. all your RAM will be pre-allocated to lwip from the start and you will not be able to allocate any new memory for your app at run-time. – Maxim Sagaydachny Mar 06 '20 at 13:38
  • @MaximSagaydachny Is there a cheap server you can recommend? – Qwe Qwe Mar 06 '20 at 13:43
  • @MaximSagaydachny Each client will be sent 20 bytes per second. – Qwe Qwe Mar 06 '20 at 13:46
  • sure. any RPI, OPI board would do. I suggest you to pick any cheap board with ethernet port – Maxim Sagaydachny Mar 06 '20 at 13:47

0 Answers0