Webserver + Modbus TCP Client and Modbus TCP Server simultaneously on ESP32-S3

Mykyta_Mar
Posts: 4
Joined: Fri Dec 08, 2023 9:28 am

Webserver + Modbus TCP Client and Modbus TCP Server simultaneously on ESP32-S3

Postby Mykyta_Mar » Fri Jan 26, 2024 2:49 pm

Hello,
I am currently trying to run Webserver + Modbus TCP Client and Modbus TCP Server simultaneously on ESP32-S3. My code is based on the examples from Espressif.
The problem is that I can't send all frontend data (js and svg are always missing in browser). But when I shut down Modbus TCP Client and Modbus TCP Server, the web server works fine.

The error massege:
E (47329) httpd: httpd_accept_conn: error in accept (23)
W (47329) httpd: httpd_server: error accepting new connection

For webserver configuration I use:

#define HTTPD_DEFAULT_CONFIG() \
{ \
.task_priority = tskIDLE_PRIORITY+5, \

.stack_size = 4096, \

.core_id = tskNO_AFFINITY, \

.server_port = 80, \

.ctrl_port = ESP_HTTPD_DEF_CTRL_PORT, \

.max_open_sockets = 7, \
.max_uri_handlers = 30, \
.max_resp_headers = 8, \
.backlog_conn = 5, \
.lru_purge_enable = false, \
.recv_wait_timeout = 5, \
.send_wait_timeout = 5, \
.global_user_ctx = NULL, \
.global_user_ctx_free_fn = NULL, \
.global_transport_ctx = NULL, \

.global_transport_ctx_free_fn = NULL, \

.enable_so_linger = false, \

.linger_timeout = 0, \

.keep_alive_enable = false, \

.keep_alive_idle = 0, \

.keep_alive_interval = 0, \

.keep_alive_count = 0, \

.open_fn = NULL, \

.close_fn = NULL, \

.uri_match_fn = NULL \
\

}

I have played with max_open_sockets, but it doesn't seem to give good results.
As I understood, Modbus TCP client, Modbus TCP server and webserver all use sockets. Is this a bottleneck in my case?

Can anyone suggest how to optimize this?

Who is online

Users browsing this forum: No registered users and 172 guests