AT Commands For TCP/IP
No | Command | Description |
F1101 | AT+NETOPEN | Start TCPIP service |
F1102 | AT+NETCLOSE | Stop TCPIP service |
F1103 | AT+CIPOPEN | Setup TCP/UDP client socket connection |
F1104 | AT+CIPCLOSE | Destroy TCP/UDP client socket connection |
F1105 | AT+CIPSEND | Send TCP/UDP data |
F1106 | AT+CIPRXGET | Retrieve TCP/UDP buffered data |
F1107 | AT+IPADDR | Get IP address of PDP context |
F1108 | AT+CIPHEAD | Add an IP header when receiving data |
F1109 | AT+CIPSRIP | Show remote IP address and port |
F1110 | AT+CIPMODE | Select TCP/IP application mode |
F1111 | AT+CIPSENDMOE | Set sending mode |
F1112 | AT+CIPTIMEOUT | Set TCP/IP timeout value |
F1113 | AT+CIPCCFG | Configure parameters of socket |
F1114 | AT+SERVERSTART | Startup TCP server |
F1115 | AT+SERVERSTOP | Stop TCP server |
F1116 | AT+CIPACK | Query TCP connection data transmitting status |
F1131 | AT+CDNSGIP | Query the IP address of given domain name |
F1132 | AT+CDNSGHNAME | Query the domain name of given IP address |
F1133 | AT+CIPDNSSET | Set DNS query parameters |
F1134 | AT+CPING | Ping destination address |
F1135 | AT+CPINGSTOP | Stop an ongoing ping session |
L1101 AT+NETOPEN Start TCP/IP Service
AT+NETOPEN is used to start socket service by activating PDP context.
You must execute AT+NETOPEN before any other TCP/UDP related operations
R) AT+NETOPEN? |
+NETOPEN: <net_state> OK |
E) AT+NETOPEN |
If the PDP context has not been activated or the network closed abnormally, response: OK +NETOPEN: <err> when the PDP context has been activated successfully, if you execute AT+NETOPEN again, +IP ERROR: Network is already opened ERROR other: ERROR |
Maximum Response Time | 120000ms |
<net_state> |
Integer type, which indicates the state of PDP context activation. 0 network close (deactivated) 1 network open(activated) |
<err> | Integer type, the result of operation. 0 is success, other value is failure. |
Example |
AT+NETOPEN OK +NETOPEN: 0 AT+NETOPEN? +NETOPEN: 1 OK |
NOTE
You must execute AT+NETOPEN before any other TCP/UDP related operations
L1102 AT+NETCLOSE Stop TCP/IP Service
AT+NETCLOSE is used to stop socket service by deactivating PDP context.
It also can close all the opened socket connections when you didn’t close these connections by AT+CIPCLOSE
E) AT+NETCLOSE |
If the PDP context has been activated, response: OK +NETCLOSE: <err> If the PDP context has not been activated, response: +NETCLOSE: <err> ERROR other: ERROR |
<err> | Integer type, the result of operation. 0 is success, other value is failure. |
Example |
AT+NETCLOSE OK +NETCLOSE: 0 |
NOTE
“AT+NETCLOSE” can close all the opened socket connections when you didn’t close these connections by “AT+CIPCLOSE”
L1103 AT+CIPOPEN Setup TCP/UDP Client Socket Connection
This command is used to setup TCP/UDP client socket connection.
Note: If there is other service working in transparent mode, it is not allowed setup transparent connection by cipopen cmd
T) AT+CIPOPEN=? |
+CIPOPEN: (0-9),(“TCP”,”UDP”) OK |
R) AT+CIPOPEN? |
+CIPOPEN: <link_num> [,<type>,<serverIP>,<serverPort>,<index>] +CIPOPEN: <link_num> [,<type>,<serverIP>,<serverPort>,<index>] […] OK If a connection identified by <link_num>has not been established successfully, +CIPOPEN: <link_num> will be returned |
TCP connection W) AT+CIPOPEN=<link_num>,”TCP”, <serverIP>,<ser verPort>,[,<localPort>] |
if PDP context has been activated successfully, response: OK +CIPOPEN: <link_num>,<err> when the <link_num> is greater than 10, response: +IP ERROR: Invalid parameter ERROR If PDP context has not been activated, or the connection has been established, or parameter is incorrect, or other errors, response: +CIPOPEN: <link_num>,<err> ERROR Transparent mode for TCP connection: When you want to use transparent mode to transmit data, you should set AT+CIPMODE=1 before AT+NETOPEN. And if AT+CIPMODE=1 is set, the <link_num> is restricted to be only 0. if success CONNECT [<text>] if failure CONNECT FAIL other: ERROR |
UDP connection W) AT+CIPOPEN=<link_num>, ”UDP”,,,<localPort> |
if PDP context has been activated successfully, response: +CIPOPEN: <link_num>,0 OK when the <link_num> is greater than 10, response: +IP ERROR: Invalid parameter ERROR If PDP context has not been activated, or the connection has been established, or parameter is incorrect, or other errors, response: +CIPOPEN: <link_num>,<err> ERROR Transparent mode for UDP connection: When you want to use transparent mode to transmit UDP data, you should set AT+CIPMODE=1 before AT+NETOPEN. And if AT+CIPMODE=1 is set, the <link_num> is restricted to be only 0. <serverIP> and <serverPort> should be set if AT+CIPMODE=1. if success CONNECT [<text>] if failure CONNECT FAIL Other: ERROR |
Maximum Response Time | 120000ms |
<link_num> |
Integer type, identifies a connection. Range is 0-9. If AT+CIPMODE=1 is set, the <link_num> is restricted to be only 0. |
<type> |
String type, identifies the type of transmission protocol. TCP Transmission Control Protocol UDP User Datagram Protocol |
<serverIP> |
String type, identifies the IP address of server. The IP address format consists of 4 octets separated by decimal point, like ”AAA.BBB.CCC.DDD”. Also the domain name is supported here. NOTE: If the domain name is inputted here, the timeout value for the AT+CIPOPEN shall be decided by AT+CIPDNSSET. |
<serverPort> |
Integer type, identifies the port of TCP server, range is 0-65535. NOTE: When open port as TCP, the port must be the opened TCP port; When open port as UDP, the port may be any port. But, for Qualcomm, connecting the port 0 is regarded as an invalid operation. |
<localPort> | Integer type, identifies the port of local socket, range is 0-65535. |
<index> |
Integer type, which indicates whether the module is used as a client or server. When used as server, the range is 0-3. <index> is the server index to which the client is linked. (-1) TCP/UDP client (0-3) TCP server index |
<text> |
String type, which indicates CONNECT result code. Please refer to ATX/AT\V/AT&E command for the string formats. |
<err> | Integer type, the result of operation.0 is success, other value is failure. |
Example |
AT+CIPOPEN=0,”TCP”,”116.228.221.51”,100 OK +CIPOPEN: 0,0 AT+CIPOPEN=1,”UDP”,,,8080 +CIPOPEN: 1,0 OK AT+CIPOPEN=? +CIPOPEN: (0-9),(“TCP”,”UDP”) OK AT+CIPOPEN? +CIPOPEN: 0,”TCP”,”116.228.221.51”,100,-1 +CIPOPEN: 1 +CIPOPEN: 2 +CIPOPEN: 3 +CIPOPEN: 4 +CIPOPEN: 5 +CIPOPEN: 6 +CIPOPEN: 7 +CIPOPEN: 8 +CIPOPEN: 9 OK |
L1104 AT+CIPCLOSE Destroy TCP/UDP Client Socket Connection
AT+CIPCLOSE is used to close TCP or UDP Socket.
T) AT+CIPCLOSE=? |
+CIPCLOSE: (0-9) OK |
R) AT+CIPCLOSE? |
+CIPCLOSE: <link0_state>,<link1_state>,<link2_state>,<link3_state>,<link4_state>,<link5_state>, <link6_state>,<link7_state>,<link8_state>,<link9_state> OK |
W) AT+CIPCLOSE=<link_num> |
If service type is TCP and the connection identified by <link_num> has been established, response: OK +CIPCLOSE: <link_num>,<err> If service type is TCP and the access mode is transparent mode, response: OK CLOSED +CIPCLOSE: <link_num>,<err> If service type is UDP and the connection identified by <link_num> has been established, response: +CIPCLOSE: <link_num>,0 OK If service type is UDP and access mode is transparent mode, response: CLOSED +CIPCLOSE: <link_num>,<err> OK If the connection has not been established, abnormally closed, or parameter is incorrect, response: +CIPCLOSE: <link_num>,<err> ERROR Other: ERROR |
<link_num> | Integer type, which identifies a connection. Range is 0-9. |
<link_state> |
Integer type, which indicates the state of connection identified by <link_num>. Range is 0-1. 0 disconnected 1 connected |
<err> | Integer type, the result of operation. 0 is success, other value is failure |
Example |
AT+CIPCLOSE? +CIPCLOSE: 1,0,0,0,0,0,0,0,0,0 OK AT+CIPCLOSE=? +CIPCLOSE: (0-9) OK AT+CIPCLOSE=0 OK +CIPCLOSE: 0,0 |
L1105 AT+CIPSEND Send TCP/UDP Data
AT+CIPSEND is used to send data to remote side. If service type is TCP,
the data will be firstly sent to the module’s internal TCP/IP stack, and then sent to server by protocol stack.
The <length> field can be empty. When it is empty, Each <Ctrl+Z> character present in the data should be coded as <ETX><Ctrl+Z>.
Each <ESC> character present in the data should be coded as <ETX><ESC>. Each <ETX> character will be coded as <ETX><ETX>.
Single <Ctrl+Z> means end of the input data. Single <ESC> is used to cancel the sending.
<ETX> is 0x03, <Ctrl+Z> is 0x1A, and <ESC> is 0x1B.
T) AT+CIPSEND=? |
+CIPSEND: (0-9),(1-1500) OK |
If service type is “TCP”, send data with changeable length
W) AT+CIPSEND=<link_num>,
Response “>”, then type data to send, tap CTRL+Z to send data, tap ESC to cancel the operation |
If the connection identified by <link_num> has been established successfully, response: > <input data> CTRL+Z OK +CIPSEND: <link_num>,<reqSendLength>, <cnfSendLength> If <reqSendLength> is equal <cnfSendLength>, it means that the data has been sent to TCP/IP protocol stack successfully.
If the connection has not been established, abnormally closed, or parameter is incorrect, response: +CIPERROR: <err> ERROR Other: ERROR |
If service type is “TCP”, send data with fixed length
W) AT+CIPSEND=<link_num>,< length>
Response “>”, type data until the data length is equal to <length> |
If the connection identified by <link_num> has been established successfully, response: > <input data with specified length> OK +CIPSEND: <link_num>,<reqSendLength>, <cnfSendLength> If <reqSendLength> is equal <cnfSendLength>, it means that the data has been sent to TCP/IP protocol stack successfully.
If the connection has not been established, abnormally closed, or parameter is incorrect, response: +CIPERROR: <err> ERROR Other: ERROR |
If service type is “UDP”, send data with changeable length
W) AT+CIPSEND=<link_num>,, <serverIP>,<serverPort>
Response “>”, then type data to send, tap CTRL+Z to send data, tap ESC to cancel the operation |
f the connection identified by <link_num> has been established successfully, response: > <input data> CTRL+Z OK +CIPSEND: <link_num>,<reqSendLength>, <cnfSendLength> If the connection has not been established, abnormally closed, or parameter is incorrect, response: +CIPERROR: <err> ERROR Other: ERROR |
If service type is “UDP”, send data with fixed length
W) AT+CIPSEND=<link_num>, < length>,<serverIP>,<server Port>
Response “>”, type data until the data length is equal to <length> |
If the connection identified by <link_num> has been established successfully, response: > <input data with specified length> OK +CIPSEND: <link_num>,<reqSendLength>, <cnfSendLength> If the connection has not been established, abnormally closed, or parameter is incorrect, response: +CIPERROR: <err> ERROR Other: ERROR |
Maximum Response Time | 120000ms |
<link_num> | Integer type, identifies a connection. Range is 0-9. |
<length> | Integer type, indicates the length of sending data, range is 1-1500. |
<serverIP> |
String type, which identifies the IP address of server. The IP address format consists of 4 octets, separated by decimal point, like ”AAA.BBB.CCC.DDD”. |
<serverPort> |
Integer type, identifies the port of TCP server, range is 0-65535. NOTE: When open port as TCP, the port must be the opened TCP port; When open port as UDP, the port may be any port. But, for Qualcomm, connecting the port 0 is regarded as an invalid operation. |
<reqSendlength> | Integer type, the length of the data requested to be sent |
<cnfSendLength> |
Integer type, the length of the data confirmed to have been sent. -1 the connection is disconnected. 0 own send buffer or other side’s congestion window are full.
Note: If the <cnfSendLength> is not equal to the <reqSendLength>, the socket then cannot be used further. |
<err> | Integer type, the result of operation.0 is success, other value is failure. |
Example |
AT+CIPSEND=0,1 >S OK +CIPSEND: 0,1,1 AT+CIPSEND=1,1,”116.236.221.75”,6775 >S OK +CIPSEND: 1,1,1 AT+CIPSEND=2, >Hello<Ctrl+Z> OK +CIPSEND: 2,5,5 AT+CIPSEND=3,,”116.236.221.75”,6775 >Hello World<Ctrl+Z> OK +CIPSEND: 3,11,11 AT+CIPSEND=2, >Hello<ESC> ERROR AT+CIPSEND? +CIPSEND: (0-9),(1-1500) OK |
NOTE
Each <Ctrl+Z> character present in the data should be coded as <ETX><Ctrl+Z>.
Each <ESC> character present in the data should be coded as <ETX><ESC>.
Each <ETX> character will be coded as <ETX><ETX>.
Single <Ctrl+Z> means the end of the input data.
Single <ESC> is used to cancel the sending.
<ETX> is 0x03, and <Ctrl+Z> is 0x1A and <ESC> is 0x1B
L1106 AT+CIPRXGET Retrieve TCP/UDP Buffered Data
If set <mode> to 1, after receiving data, the module will buffer it and report a URC as “+CIPRXGET: 1,<link_num>” to notify the host.
Then host can retrieve data by AT+CIPRXGET.
If set <mode> to 0, the received data will be outputted to COM port directly by URC
as “RECV FROM:<IP ADDRESS>:<PORT><CR><LF>+IPD(data length)<CR><LF><data>”.
The default value of <mode> is 0.
Note:
1. If the buffer is not empty, and the module receives data again,
then it will not report a new URC until all the received data has been retrieved by AT+CIPRXGET from buffer.
2. When <mode> is set to 1 and the 2-4 mode will take If initially set <mode> to 1, after doing some data transmitting, set <mode> to 0,
then the buffered data of the previously established connection will be output to the serial port directly,
and the maximum length of output data at one time is 1500.
T) AT+CIPRXGET=? |
+CIPRXGET: (0-4),(0-9),(1-1500) OK |
R) AT+CIPRXGET? |
+CIPRXGET: <mode> OK |
W) AT+CIPRXGET=<mode> In this case, <mode> can only be 0 or 1 |
If the parameter is correct, response: OK Else, response: ERROR |
W) AT+CIPRXGET=2,<link_num> [,<len>] Retrieve data in ACSII form |
If <length> field is empty, the default value to read is 1500. If the buffer is not empty, response: +CIPRXGET: <mode>,<link_num>,<read_len>,<rest_len> <data>ACSII form OK If the buffer is empty, response: +IP ERROR: No data ERROR If the parameter is incorrect or other error, response: +IP ERROR: <err_info> ERROR Other: ERROR |
W) AT+CIPRXGET=3,<link_num> [,<len>] Retrieve data in hex form |
If <length> field is empty, the default value to read is 750. If the buffer is not empty, response: +CIPRXGET: <mode>,<link_num>,<read_len>,<rest_len> <data>hex form OK If the buffer is empty, response: +IP ERROR: No data ERROR If the parameter is incorrect or other error, response: +IP ERROR: <err_info> ERROR Other: ERROR |
W) AT+CIPRXGET=4,<link_num> |
If the parameter is correct, response: +CIPRXGET: 4,<link_num>,<rest_len> OK If the parameter is incorrect or other error, response: +IP ERROR: <err_info> ERROR Other: ERROR |
<mode> |
Integer type, sets the mode to retrieve data. Default value is 0. 0 set the way to get the network data automatically 1 set the way to get the network data manually 2 read data, the max read length is 1500 3 read data in HEX form, the max read length is 750 4 get the rest data length |
<link_num> | Integer type, identifies a connection. Range is 0-9. |
<len> |
Integer type, the data length to be read. Not required, the default value is 1500 when <mode>=2, and 750 when <mode>=3. |
<read_len> | Integer type, the length of data that has been read. |
<rest_len> | Integer type, the length of data which has not been read in the buffer. |
<err_info> | String type, displays the cause of occurring error, please refer to Chapter 3 for details. |
Example |
AT+CIPRXGET=? +CIPRXGET: (0-4),(1-1500) OK AT+CIPRXGET? +CIPRXGET: 1 OK AT+CIPRXGET=1 OK AT+CIPRXGET=2,0,100 +CIPRXGET: 2,0,100,1300 01234567890123456789012345678901234567 89012345678901234567890123456789012345 678901234567890123456789 OK AT+CIPRXGET=3,0,100 +CIPRXGET: 3,0,100,1200 30313233343536373839303132333435363738 39303132333435363738393031323334353637 38393031323334353637383930313233343536 37383930313233343536373839303132333435 36373839303132333435363738393031323334 3536373839 OK
AT+CIPRXGET=4,0 +CIPRXGET: 4,0,1200 OK |
NOTE
– If set <mode> to 1, after receiving data, the module will buffer it and report a URC as “+CIPRXGET: 1,<link_num>” to notify the host.
Then host can retrieve data by AT+CIPRXGET.
– If set <mode> to 0, the received data will be outputted to COM port directly by URC
as “RECV FROM:<IP ADDRESS>:<PORT><CR><LF>+IPD(data length)<CR><LF><data>”.
– If the buffer is not empty, and the module receives data again,
then it will not report a new URC until all the received data has been retrieved by AT+CIPRXGET from
– The default value of <mode> is 0. When <mode> is set to 1 and the 2-4 mode will take effect.
– If initially set <mode> to 1, after doing some data transmitting , set <mode> to 0,
then the buffered data of the previously established connection will be output to the serial port directly,
and the maximum length of output data at a time is 1500.
L1107 AT+IPADDR Get IP Address Of PDP Context
AT+IPADDR is used to inquire socket PDP address.
E) AT+IPADDR |
If PDP context has been activated successfully, response +IPADDR: <ip_address OK Else +IP ERROR: Network not opened ERROR |
<ip_address> | String type, identifies the IP address of current active socket PDP. |
Example |
AT+IPADDR +IPADDR: 10.71.155.118 OK |
L1108 AT+CIPHEAD Add An IP Header When Receiving Data
AT+CIPHEAD is used to add an IP header when receiving data.
T) AT+CIPHEAD=? |
+CIPHEAD: (0-1) OK |
R) AT+CIPHEAD? |
+CIPHEAD: <mode> OK |
W) AT+CIPHEAD=<mode> |
If the parameter is correct, response: OK Else, Response ERROR |
E) AT+CIPHEAD |
Set default value:(<mode>=1) OK |
<mode> |
Integer type, indicates whether adding an IP header or not when receiving data. Default value is 1. 0 not add IP header 1 add IP header, the format is “+IPD(data length)” |
Example |
AT+CIPHEAD=? +CIPHEAD: (0-1) OK AT+CIPHEAD=0 OK |
L1109 AT+CIPSRIP Show Remote IP Address And Port
AT+CIPSRIP is used to set whether to display IP address and port of server when receiving data.
T) AT+CIPSRIP=? |
+CIPSRIP: (0-1) OK |
R) AT+CIPSRIP? |
+CIPSRIP: <mode> OK |
W) AT+CIPSRIP=<mode> |
If the parameter is correct, response: OK Else, response: ERROR |
E) AT+CIPSRIP |
Set default value:(<mode>=1) OK |
<mode> |
Integer type, indicates whether to show IP address and port of server or not when receiving data. Default value is 1. 0 not show 1 show, the format is as follows: “RECV FROM:<IP ADDRESS>:<PORT>” |
Example |
AT+CIPSRIP=? +CIPSRIP: (0-1) OK AT+CIPSRIP=1 OK |
L1110 AT+CIPMODE Select TCP/IP Application Mode
AT+CIPMODE is used to select transparent mode (data mode) or non-transparent mode (command mode).
The default mode is non-transparent mode.
T) AT+CIPMODE=? |
+CIPMODE: (0-1) OK |
R) AT+CIPMODE? |
CIPMODE: <mode> OK |
W) AT+CIPMODE=<mode> |
If the parameter is correct, response: OK Else, response: ERROR |
E) AT+CIPMODE |
Set default value:(<mode>=0) OK |
<mode> |
Integer type, sets TCP/IP application mode. Default value is 0. 0 Non transparent mode 1 Transparent mode |
Example |
AT+CIPMODE=? +CIPMODE: (0-1) OK AT+CIPMODE=1 OK |
L1111 AT+CIPSENDMODE Set Sending Mode
AT+CIPSENDMODE is used to select sending mode when service type is “TCP”.
1. If set <mode> to 1, with AT+CIPSEND, URC “+CIPSEND: <link_num>,<reqSendLength>,<cnfSendLength>” will not be returned
until module receives the server’s ACK message to the sent data last time.
2. If set <mode> to 0, the URC “+CIPSEND: <link_num>,<reqSendLength>,<cnfSendLength>” will be returned
If the data has been sent to module’s internal TCP/IP protocol stack. In this case, the module doesn’t need to wait for the server’s ACK message.
The default mode is sending without waiting peer TCP ACK mode.
T)AT+CIPSENDMODE=? |
+CIPSENDMODE: (0-1) OK |
R) AT+CIPSENDMODE? |
+CIPSENDMODE: <mode> OK |
W) AT+CIPSENDMODE=<mode> |
If the parameter is correct, response: OK Else, response: ERROR |
<mode> |
Integer type, sets sending mode. Default value is 0. 0 Sending without waiting peer TCP ACK mode 1 Sending wait peer TCP ACK mode |
Example |
AT+CIPSENDMODE=? +CIPSENDMODE: (0-1) OK AT+CIPSENDMODE=1 OK |
L1012 AT+CIPTIMEOUT Set TCP/IP Timeout Value
AT+CIPTIMEOUT is used to set timeout value for AT+NETOPEN/AT+CIPOPEN/AT+CIPSEND.
R) AT+CIPTIMEOUT? |
+CIPTIMEOUT: <netopen_timeout>,<cipopen_timeout>,<cipsend_timeout> OK |
W) AT+CIPTIMEOUT=[<netopen_timeout>][,[<cipopen_timeout>][,[<cipsend_timeout>]]] |
If the parameter is correct, response: OK Else, response: ERROR |
<netopen_timeout> |
Integer type, timeout value for AT+NETOPEN. default is120000ms. Range is 3000ms-120000ms. |
<cipopen_timeout> |
Integer type, timeout value for AT+CIPOPEN. default is120000ms. Range is 3000ms-120000ms. |
<cipsend_timeout> |
Integer type, timeout value for AT+CIPSEND. default is120000ms. Range is 3000ms-120000ms. |
Example |
AT+CIPTIMEOUT? +CIPTIMEOUT: 30000,20000,40000 OK AT+CIPTIMEOUT=30000,20000,40000 OK |
L1113 AT+CIPCCFG Configure Parameters Of Socket
AT+CIPCCFG is used to configure parameters of socket.
T) AT+CIPCCFG=? |
+CIPCCFG: (0-10),(0-1000),(0),(0-1),(0-1),(0-1),(500-120000) OK |
R) AT+CIPCCFG? |
+CIPCCFG: <NmRetry>,<DelayTm>,<Ack>,<errMode>,<HeaderType>,<Asyn cMode>,<TimeoutVal> OK |
W) AT+CIPCCFG=[<NmRetry>][,[ <DelayTm>][,[<Ack>][,[<errM ode>][,]<HeaderType>][,[[<As yncMode>][,[<TimeoutVal>]]]] ]]]] |
If the parameter is correct, response: OK Else, response: ERROR |
E) AT+CIPCCFG |
Set default value: OK |
<NmRetry> |
Integer type, number of retransmission to be made for an IP packet. Range is 0-10. The default value is 10. |
<DelayTm> |
Integer type, number of milliseconds to delay to output data of Receiving. Range is 0-1000. The default value is 0. |
<Ack> |
Integer type, it can only be set to 0. It’s used to be compatible with old TCP/IP command set. |
<errMode> |
Integer type, sets mode of reporting <err_info>, default value is 1. 0 error result code with numeric values 1 error result code with string values |
<HeaderType> |
Integer type, select which data header is used when receiving data, it only takes effect in multi-client mode. Default value is 0. 0 add data header, the format is “+IPD<data length>” 1 add data header, the format is “+RECEIVE,<link num>,<data length>” |
<AsyncMode> |
Integer type, range is 0-1. Default value is 0. It’s used to be compatible with old TCP/IP command set. |
<TimeoutVal> |
Integer type, set the minimum retransmission timeout value for TCP connection. Range is 500ms-120000ms. Default is 500ms. |
Example |
AT+CIPCCFG=? +CIPCCFG: (0-10),(0-1000),(0),(0-1),(0-1),(0),(500-120000) OK AT+CIPCCFG=3,500,0,1,1,1,500 OK |
L1114 AT+SERVERSTART START Startup TCP server
AT+SERVERSTART is used to startup a TCP server, and the server can receive the request of TCP client.
After the command executes successfully, an unsolicited result code is returned when a client tries to connect with module and module accepts request.
The unsolicited result code is +CLIENT: <link_num>,<server_index>,<client_IP>:<port>.
T) AT+SERVERSTART=? |
+SERVERSTART: (0-65535),(0-3) OK |
R) AT+SERVERSTART? |
If the PDP context has not been activated successfully, response: +CIPERROR: <err> ERROR If there exists opened server, response: [+SERVERSTART: <server_index>,< port> …] OK Other: ERROR |
W) AT+SERVERSTART=<port>,< server_index>[,<backlog>] |
If there is no error, response: OK If the PDP context has not been activated, or the server identified by <server_index> has been opened, or the parameter is not correct, or other errors, response: +CIPERROR: <err> ERROR Other: ERROR |
<port> | Integer type, identifies the listening port of module when used as a TCP server. Range is 0-65535. |
<server_index> | Integer type, the TCP server index, range is 0-3. |
Example |
AT+SERVERSTART=? +SERVERSTART: 0,1000 OK AT+SERVERSTART=8080,1 OK |
NOTE
After the “AT+SERVERSTART” executes successfully, an unsolicited result code is returned
when a client tries to connect with module and module accepts request.
The unsolicited result code is+CLIENT: < link_num>,<server_index>,<client_IP>:<port>.
L1115 AT+SERVERSTOP Stop TCP Server
AT+SERVERSTOP is used to stop TCP server. Before stopping a TCP server,
all sockets <server_index> of which equals to the closing TCP server index must be closed first.
W) AT+SERVERSTOP=<server_i ndex> |
If there exists open connection with the server identified by <server_index>, or the server identified by <server_index> has not been opened, or the parameter is incorrect, response: +SERVERSTOP: <server_index>,<err> ERROR If the server socket is closed immediately, response: +SERVERSTOP: <server_index>,0 OK (In general, the result is shown as below.) If the server socket starts to close, response: OK +SERVERSTOP: <server_index>,<err> Other: ERROR |
<server_index> | Integer type, the TCP server index, range is 0-3. |
<err> | Integer type, the result of operation.0 is success, other value is failure. |
Example |
AT+SERVERSTOP=0 +SERVERSTOP: 0,0 OK |
NOTE
Before stopping a TCP server, all sockets <server_index> of which equals to the closing TCP server index must be closed first.
L1116 AT+CIPACK Query TCP connection data transmitting status
AT+CIPACK is used to query TCP connection data (only in command mode) transmitting status.
T) AT+CIPACK=? |
+CIPACK: (0-9) OK |
W) AT+CIPACK=<link_num> |
If the PDP context has not been activated, or the connection identified by <link_num> has not been established, abnormally closed, or the parameter is incorrect, or other errors, response: +IP ERROR: <err_info> ERROR If the connection has been established, and the service type is “TCP”, response: +CIPACK: <sent_data_size>,<ack_data_size>,<recv_data_size> OK |
<link_num> | Integer type, identifies a connection. Range is 0-9. |
<sent_data_size> | Integer type, the total length of sent data |
<ack_data_size> | Integer type, the total length of acknowledged data. |
<recv_data_size> | Integer type, the total length of received data |
<err> | Integer type, the result of operation. 0 is success, other value is failure. |
<err_info> | String type, displays the cause of occurring error, please refer to Chapter 11.5 for details. |
Example |
AT+CIPACK=? +CIPACK: (0-9) OK AT+CIPACK=0 +CIPACK: 16,16,5 OK |
L1131 AT+CDNSGIP Query the IP address of given domain name
AT+CDNSGIP is used to query the IP address of given domain name.
T) AT+CDNSGIP=? | OK |
W) AT+CDNSGIP=<domain name> |
If the given domain name has related IP, response: +CDNSGIP: 1,<domain name>,<IP address> OK
If the given name has no related IP, response: +CDNSGIP: 0,<dns error code> ERROR
Other: ERROR |
<domain name> |
String type (string should be included in quotation marks), indicates the domain name. The maximum length of domain name is 254. Valid characters allowed in the domain name area-z, A-Z, 0-9, “-“(hyphen) and “.”. A domain name is made up of one label name or more label names separated by “.” (e.g. AT+CDNSGIP=”aa.bb.cc”). For label names separated by “.”, length of each label must be no more than 63 characters. The beginning character of the domain name and of labels should be an alphanumeric character. |
<IP address> | String type, indicates the IP address corresponding to the domain name. |
<dns error code> |
Integer type, indicates the error code. 10 DNS GENERAL ERROR |
Example |
AT+CDNSGIP=”www.baidu.com” +CDNSGIP: 1,”www.baidu.com”,”61.135.169.21” OK |
1132 AT+CDNSGHNAME Query the domain name of given IP address
AT+CDNSGHNAME is used to query the domain name of given IP address.
T) AT+CDNSGHNAME=? | OK |
W) AT+CDNSGHNAME=<IP address> |
If the given IP address has related domain name, response: +CDNSGHNAME: <index>,<domain name>,<IP address OK
If the given IP address has no related domain name, response: +CDNSGHNAME: 0,<dns error code> OK
If the given IP address has no related domain name, response: +CDNSGHNAME: 0,<dns error code> ERROR Other: ERROR |
<domain name> |
String type (string should be included in quotation marks), indicates the domain name. The maximum length of domain name is 254. Valid characters allowed in the domain name area-z, A-Z, 0-9, “-“(hyphen) and “.”.
A domain name is made up of one label name or more label names separated by “.” (e.g. AT+CDNSGIP=”aa.bb.cc”).
For label names separated by “.”, length of each label must be no more than 63 characters. The beginning character of the domain name and of labels should be an alphanumeric character. |
<IP address> |
String type (string should be included in quotation marks), indicates the IP address corresponding to the domain name. |
<dns error code> |
Integer type, which indicates the error code. 10 DNS GENERAL ERROR |
<index> |
Integer type, which indicates DNS result index. This value is always 1 if performing successfully. Currently, only the first record returned from the DNS server will be reported. |
Example |
AT+CDNSGHNAME=”58.32.231.148” +CDNSGHNAME: 1,”mail.sim.com”,”58.32.231.148” OK |
L1133 AT+CIPDNSSET Set DNS query parameters
AT+CIPDNSSET is used to set DNS Query Parameters
R) AT+CIPDNSSET? |
+CIPDNSSET: 3,30000,7 OK |
W) AT+CIPCCFG=[<max_net_retries>][,[<net_timeout>][,[<max_query_retries>]]] |
If the parameter is correct, response: OK
Else, response: ERROR |
<max_net_retries> |
Integer type, maximum retry times for opening PS network to perform DNS query. Range is 0-3. Default is 3. |
<netopen_timeout> |
Integer type, timeout value for each opening PS network operation when performing DNS query. Range is 3000ms-120000ms. Default value is 30000ms. |
<max_query_retries> |
Integer type, maximum retry times for performing DNS query using UDP packet. Range is 0-7. Default value is 7. |
Example |
AT+CIPDNSSET? +CIPDNSSET: 1,30000,3 OK |
L1134 AT+CPING Ping Destination Address
This command is used to ping destination address.
T) AT+CPING=? |
+CPING: IP address, (list of supported <dest_addr_type>s),(1-100),(4-188),(1000-10000), (10000-100000), (16-255) OK |
W) AT+CPING=<dest_addr>,<de st_addr_type>[,<num_pings> [,<data_packet_size>[,<interv al_time>[,<wait_time>[,<TTL> ]]]]] |
OK
If ping’s result_type = 1 +CPING: <result_type>,<resolved_ip_addr>,<data_packet_size>,<rtt>,<T TL>
If ping’s result_type = 2 +CPING: <result_type>
If ping’s result_type = 3 +CPING: <result_type>,<num_pkts_sent>,<num_pkts_recvd>,<num_pkts _lost>,<min_rtt>,<max_rtt>,<avg_rtt> |
<dest_addr> |
The destination is to be pinged; it can be an IP address or a domain name. |
<dest_addr_type> |
Integer type. Address family type of the destination address 1 IPv4. 2 IPv6(reserved) |
<num_pings> |
Integer type. The num_pings specifies the number of times the ping request (1-100) is to be sent. The default value is 4. |
<data_packet_size> | Integer type. Data byte size of the ping packet (4-188). The default value is 64 bytes. |
<interval_time> |
Integer type. Interval between each ping. Value is specified in milliseconds (1000ms-10000ms). The default value is 2000ms. |
<wait_time> |
Integer type. Wait time for ping response. An ping response received after the timeout shall not be processed. Value specified in milliseconds (10000ms-100000ms). The default value is 10000ms |
<TTL> |
Integer type. TTL(Time-To-Live) value for the IP packet over which the ping(ICMP ECHO Request message) is sent (16-255), the default value is 255. |
<result_type> |
1 Ping success 2 Ping time out 3 Ping result |
<num_pkts_sent> | Indicates the number of ping requests that were sent out. |
<num_pkts_recvd> | Indicates the number of ping responses that were received. |
<num_pkts_lost> | Indicates the number of ping requests for which no response was received |
<min_rtt> | Indicates the minimum Round Trip Time(RTT). |
<max_rtt> | Indicates the maximum RTT. |
<avg_rtt> | Indicates the average RTT. |
<resolved_ip_addr> | Indicates the resolved ip address. |
< rtt> | Round Trip Time. |
Example |
AT+CPING=”www.baidu.com“,1,4,64,1000,10 000,255 OK +CPING: 1,119.75.217.56,64,410,255 +CPING: 1,119.75.217.56,64,347,255 +CPING: 1,119.75.217.56,64,346,255 +CPING: 1,119.75.217.56,64,444,255 +PING: 3,4,4,0,346,444,386 |
L1135 AT+CPINGSTOP Stop An Ongoing Ping Session
This command is used to stop an ongoing ping session.
T) AT+CPINGSTOP=? | OK |
W) AT+CPINGSTOP |
+CPING: <result_type>,<num_pkts_sent>,<num_pkts_recvd>,<num_pkts _lost>,<min_rtt>,<max_rtt>,<avg_rtt> OK ERROR |
<result_type> |
1 Ping success 2 Ping time out 3 Ping result |
<num_pkts_sent> | Indicates the number of ping requests that were sent out. |
<num_pkts_recvd> | Indicates the number of ping responses that were received. |
<num_pkts_lost> | Indicates the number of ping requests for which no response was received. |
<resolved_ip_addr> | Indicates the resolved ip address. |
<min_rtt> | Indicates the minimum Round Trip Time (RTT). |
<max_rtt> | Indicates the maximum RTT. |
<avg_rtt> | Indicates the average RTT. |
Example |
AT+CPINGSTOP +CPING: 3,2,2,0,46,49,47 OK |