[ESP32 Only] Ethernet AT Examples

Note

Before you run any Ethernet AT commands, please make sure you have followed the Prerequisite.

Establish a TCP Connection on Ethernet Network

  1. Enable multiple connections.

    • Command

      AT+CIPMUX=1
      
    • Response

      OK
      
  2. Create a TCP server.

    • Command

      AT+CIPSERVER=1,8081
      
    • Response

      OK
      
  3. Obtain the IP address of the server.

    • Command

      AT+CIPETH?
      
    • Response

      +CIPETH:ip:192.168.105.24
      +CIPETH:gateway:192.168.105.1
      +CIPETH:netmask:255.255.255.0
      OK
      
  4. Use a network tool on PC to create a TCP client and connect to the TCP server that ESP created. (IP: 192.168.105.24, Port: 8081).

  5. Send data in Normal Transmission Mode.

    • Command

      AT+CIPSEND=0,4    // send 4 bytes to connection ID 0
      
    • Response

      OK
      >
      
    • Enter the data.

    • Response

      SEND OK
      

    Note: If the length of the data you entered is more than the value of <length> (n) set by AT+CIPSEND, the system will prompt busy, and send the first n bytes. After sending the first n bytes, the system will reply SEND OK.

  6. Receive data in Normal Transmission Mode.

    When the ESP server receives data, AT will prompt:

    +IPD,n:xxxxxxxxxx    // received n bytes, data=xxxxxxxxxxx
    
  7. Close TCP Connection.

    • Command

      AT+CIPCLOSE=0
      
    • Response

      OK
      
  8. Delete the TCP server.

    • Command

      AT+CIPSERVER=0
      
    • Response

      OK