Running two servers on ESP32

I would like to run two separate server processes on an ESP32-S3. The target project is an environmental controller using a distributed network of ESP8266 based sensors/actuators operating as socket clients with an an ESP32 based central controller providing the socket server and control functions and a web based user interface. Ideally I would like to run the web server on one core of the ESP32 and the controller and socket server on the other.
I already have a web server , a socket server talking to the ESP8266's and multiprocessing operating on the ESP32 as separate entities but before I disappear down too many rabbit holes, does anyone know if what I am trying to achieve is even possible and, if so, what synchronisation mechanisms I may need to put in place to stop the two servers tripping over each other when they access the network.

The webinterface (HTTP) could run on one core and you could have a connectionless / UDP server socket on the other core that receives data from the sensors on the other core. Should be no problem, but I would absolutely not use persistent connections (TCP) for the sensors. If you need to synchronize data between the two cores, you can use queues and semaphores.

Hi @jwalters1955

You can adapt the Esp32-AdvancedWebServer example of WebSockets2_Generic library for your use-case, if suitable.

This is the result when running on ESP32-S2, but I don't see any issue with ESP32-S3

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.