User Manual

! ! " !
Espressif Systems
ESP8266
AT Command Examples
3.1.
UDP (remote IP and port are fixed)
In UDP transmission, whether remote IP and port is fixed or not is decided by the last parameter of
AT+CIPSTART. “0” means that the remote IP and port is fixed and cannot be changed. A specific ID
is given to such connection, making sure that the data sender and receiver will not be replaced by
other devices.
Enable multiple connection:
AT+CIPMUX=1
Response :OK
Create a UDP transmission, for example, ID is 4.
AT+CIPSTART=4, "UDP", "192.168.101.110", 8080, 1112, 0
Response :4, CONNECT OK
Note :
"192.168.101.110", 8080 here is the remote IP and port of UDP transmission of the opposite side,
i.e., the configuration set by PC.
1112 is the local port of ESP8266. User can self-define this port. The value of this port will be random
if it’s not defined beforehand.
0 means that remote IP and port is fixed and cannot be changed. For example, if another PC also
creates a UDP entity and sends data to ESP8266 port 1112. ESP8266 can receive data sent from
UDP port 1112, but when data is sent using AT command “AT+CIPSEND=4, X, it will still be sent to
the first PC end. If this parameter is not 0, it will send to a new PC.
Send data:
AT+CIPSEND=4, 5 // Send 5 bytes to transmission NO.4
>DGFYQ // enter the data, no CR
Response :SEND OK
Note:
If the number of bytes sent is bigger than the size defined (n), will reply busy, and after sending n
number of bytes, reply SEND OK.
Receive data:
+IPD, 4, n: xxxxxxxxxx // received n bytes, data=xxxxxxxxxxx
Delete UDP transmission NO.4:
AT+CIPCLOSE=4
Response :4, CLOSED OK
Espressif Systems Confidential / Friday, Oct 23, 20158 16