Esp32 As A Tcp Server In Multiple Connections - Espressif Systems ESP32 Instruction Set

At instruction set and examples
Hide thumbs Also See for ESP32:
Table of Contents

Advertisement

!

9.4. ESP32 as a TCP Server in Multiple Connections

When ESP32 works as a TCP server, multiple connections should be enabled; that is to
say, there should be more than one client connecting to ESP32.
Below is an example showing how a TCP server is established when ESP32 works in the
SoftAP mode. If ESP32 works as a Station, set up a server in the same way after
connecting ESP32 to the router.
1. Set the Wi-Fi mode:
AT+CWMODE=3 // SoftAP+Station mode
Response:
OK
2. Enable multiple connections:
AT+CIPMUX=1
Response:
OK
3. Set up a TCP server:
AT+CIPSERVER=1 // default port = 333
Response:
OK
4. Connect the PC to the ESP32 SoftAP:
5. Using a network tool on PC to create a TCP client and connect to the TCP server that
ESP created.
⚠ Notice:
When ESP32 works as a TCP server, there is a timeout mechanism. If the TCP client is connected to the
ESP32 TCP server, while there is no data transmission for a period of time, the server will disconnect from
the client. To avoid such a problem, please set up a data transmission cycle every two seconds.
Espressif
!
74 97
!
/!
9. AT Commands Examples
2019.06

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents