Quectel LTE Standard TCP (IP) Application Note V1.1
Quectel LTE Standard TCP (IP) Application Note V1.1
Application Note
Rev. LTE_Standard_TCP/IP_Application_Note_V1.1
Date: 2019-10-28
Status: Released
www.quectel.com
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:
GENERAL NOTES
QUECTEL OFFERS THE INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION
PROVIDED IS BASED UPON CUSTOMERS’ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT
TO ENSURE THE QUALITY OF THE INFORMATION IT MAKES AVAILABLE. QUECTEL DOES NOT
MAKE ANY WARRANTY AS TO THE INFORMATION CONTAINED HEREIN, AND DOES NOT ACCEPT
ANY LIABILITY FOR ANY INJURY, LOSS OR DAMAGE OF ANY KIND INCURRED BY USE OF OR
RELIANCE UPON THE INFORMATION. ALL INFORMATION SUPPLIED HEREIN IS SUBJECT TO
CHANGE WITHOUT PRIOR NOTICE.
COPYRIGHT
THE INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF
QUECTEL WIRELESS SOLUTIONS CO., LTD. TRANSMITTING, REPRODUCTION, DISSEMINATION
AND EDITING OF THIS DOCUMENT AS WELL AS UTILIZATION OF THE CONTENT ARE
FORBIDDEN WITHOUT PERMISSION. OFFENDERS WILL BE HELD LIABLE FOR PAYMENT OF
DAMAGES. ALL RIGHTS ARE RESERVED IN THE EVENT OF A PATENT GRANT OR
REGISTRATION OF A UTILITY MODEL OR DESIGN.
Copyright © Quectel Wireless Solutions Co., Ltd. 2019. All rights reserved.
LTE_Standard_TCP/IP_Application_Note 1 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
History
Duke XIN/
1.0 2017-11-22 Initial
Shirly WANG
1. Added applicable module of this document
(Chapter 1)
2. Updated description of parameters for command
AT+QICSGP (Chapter 2.1.1).
3. Updated the description of parameter <context_ty
pe> for command AT+QIACT (Chapter 2.1.2).
4. Updated the description of parameter <service_ty
pe> for commands AT+QIOPEN (Chapter
2.1.4), AT+QISTATE (Chapter 2.1.6), AT+QISEND
1.1 2019-10-28 Larson LI
(Chapter 2.1.7) and AT+QIRD (Chapter 2.1.8).
5. Added commands AT+QICFG="tcp/keepalive", AT
+QICFG="recv/buffersize" and AT+QICFG="recvin
d" and related parameters (Chapter 2.1.15).
6. Updated the description of parameters <send_dat
a_format> and <recv_data_format> for command
AT+QICFG="dataformat" (Chapter 2.1.15).
7. Updated example of receiving data from remote
server in buffer access mode (Chapter 3.2.3).
LTE_Standard_TCP/IP_Application_Note 2 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Contents
1 Introduction .......................................................................................................................................... 6
1.1. The Process of Using TCP/IP AT Commands ............................................................................. 6
1.2. Description of Data Access Modes .............................................................................................. 8
3 Examples ............................................................................................................................................ 35
3.1. Configure and Activate a Context .............................................................................................. 35
3.1.1. Configure a Context ....................................................................................................... 35
3.1.2. Activate a Context .......................................................................................................... 35
3.1.3. Deactivate a Context ...................................................................................................... 35
3.2. TCP Client Works in Buffer Access Mode ................................................................................. 35
3.2.1. Set up a TCP Client Connection and Enter into Buffer Access Mode ........................... 35
3.2.2. Send Data in Buffer Access Mode ................................................................................. 36
3.2.3. Receive Data from Remote Server in Buffer Access Mode ........................................... 36
LTE_Standard_TCP/IP_Application_Note 3 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
5 Appendix A Reference....................................................................................................................... 46
LTE_Standard_TCP/IP_Application_Note 4 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Table Index
LTE_Standard_TCP/IP_Application_Note 5 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
1 Introduction
Quectel LTE Standard modules feature embedded TCP/IP stack, which enables the host to access the
Internet directly via AT commands. This greatly reduces the dependence on external PPP and TCP/IP
protocol stacks and thus minimizes the cost. LTE Standard modules provide the following socket services:
TCP client, UDP client, TCP server and UDP server.
Through TCP/IP AT commands, the host can configure a PDP context, activate/deactivate the PDP
context, start/close socket service and send/receive data via socket service. The following figure
illustrates how to use TCP/IP AT commands.
LTE_Standard_TCP/IP_Application_Note 6 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
PS Service:
1. If <stat> of AT+CGREG?/AT+CEREG? Register on CS domain service in 60s
equals to 1 or 5, it means that the module
has registered on PS domain service in Query PS service in 60s by
UMTS/LTE network. AT+CGREG?/
2. Go to next step no matter whether it is AT+CEREG?
registered on PS domain service or not in
60s.
Notes:
1. Please note that users need to wait for the final response (for example "OK", "CME ERROR", "CMS ERROR") of the last AT command you
entered before you enter the next AT command. You can reboot the module if the module fails to get response in 60s.
2. Reboot the module if the module has not got response of AT+QIACT in 150s or response of AT+QICLOSE in 10s and in 40s.
3. It is NOT recommended to frequently reboot the module. When the module has been continuously rebooted for 3 times due to failed AT command
execution, it can be rebooted immediately for the first time after that. If it still fails, reboot the module after 10 minutes for the second time, and reboot
after 30 minutes for the third time, one hour for the fourth time, etc.
LTE_Standard_TCP/IP_Application_Note 7 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
LTE Standard modules support the following three kinds of data access modes:
When opening a socket service via AT+QIOPEN, the data access mode can be specified by the
parameter <access_mode>. After a socket service is opened, customers can switch the access mode via
AT+QISWTMD.
1. In buffer access mode, data can be sent via AT+QISEND command, and if the module has received
the data from the Internet, it will buffer the data and report a URC as +QIURC: "recv",<connectID>.
Data can be read via AT+QIRD command.
2. In direct push mode, data can be sent via AT+QISEND command, and if the module has received the
data from the Internet, the data will be outputted to COM port directly in the following format:
+QIURC: "recv",<connectID>,<currectrecvlength><CR><LF><data>.
3. In transparent access mode, the corresponding port (such as UART, USB modem port, etc.) enters
into the exclusive mode. The data received from COM port will be sent to the Internet directly, and the
data received from Internet will be outputted via COM port directly. +++ can be used to exit from
transparent access mode. When OK is returned, the module will be switched to buffer access mode.
AT+QISWTMD can be used to switch the data access mode back to transparent access mode.
To exit from the transparent access mode, +++ or DTR (AT&D1 should be set first) can be used. To
prevent the +++ from being misinterpreted as data, the following sequence should be followed:
LTE_Standard_TCP/IP_Application_Note 8 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
NOTES
1. In buffer access mode, if the buffer is not empty, the module will not report a new URC until all the
received data has been read via AT+QIRD from the buffer.
2. In transparent access mode, AT commands cannot be executed. If the socket connection is closed
because of network error or other errors, the module will report NO CARRIER and exit from the
transparent access mode. In this case, AT+QICLOSE should be executed to close the socket
service.
LTE_Standard_TCP/IP_Application_Note 9 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
The command can be used to configure the <APN>, <username>, <password> and other parameters of
a TCP/IP context. The QoS settings can be configured by AT+CGQMIN, AT+CGEQMIN, AT+CGQREQ
and AT+CGEQREQ.
OK
WriteCommand Response
Query the configuration of a specified +QICSGP: <context_type>,<APN>,<username>,<passwor
context d>,<authentication>
AT+QICSGP=<contextID>
OK
Write Command Response
Configure the context OK
AT+QICSGP=<contextID>[,<context_t
ype>,<APN>[,<username>,<password If there is any error:
>)[,<authentication>[,<cdma_pwd>]]]] ERROR
Parameter
LTE_Standard_TCP/IP_Application_Note 10 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
<password> String type. The password. The maximum length is 127 bytes.
<authentication> Integer type. The authentication methods.
0 None
1 PAP
2 CHAP
3 PAP or CHAP
<cdma_pwd> Integer type. To configure whether to save <username> and <password> over
CDMA network.
0 Disable
1 Enable
Example
OK
AT+QICSGP=1,1,"UNINET","","",1 //Configure context 1. APN is "UNINET" for China Unicom.
OK
Before activating a PDP context via AT+QIACT, the context should be configured by AT+QICSGP. After
activation, the IP address can be queried via AT+QIACT?.
Although the range of <contextID> is 1-16, the module supports maximum three PDP contexts activated
simultaneously. Depending on the network, it may take at most 150 seconds to return OK or ERROR after
executing AT+QIACT. Before the response is returned, other AT commands cannot be executed.
OK
Read command Response
AT+QIACT? Return the list of the currently activated contexts and their IP
addresses:
+QIACT: 1,<context_state>,<context_type>[,<IP_addres
s>]
[.....
+QIACT: 16,<context_state>,<context_type>[,<IP_addres
s>]]
LTE_Standard_TCP/IP_Application_Note 11 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
OK
Parameter
The command is used to deactivate a specific context and close all TCP/IP connections set up in this
context. Depending on the network, it may take at most 40 seconds to return OK or ERROR after
executing AT+QIDEACT. Before the response is returned, other AT commands cannot be executed.
OK
Write Command Response
AT+QIDEACT=<contextID> OK
LTE_Standard_TCP/IP_Application_Note 12 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Parameter
The command is used to open a socket service. The service type can be specified by <service_type>
parameter. The data access mode (buffer access mode, direct push mode and transparent access mode)
can be specified by <access_mode> parameter. The URC +QIOPEN indicates whether the socket
service has been opened successfully.
1. If <service_type> is "TCP LISTENER", the module works as TCP server. After accepting a new TCP
connection, the module will automatically specify a <connectID> and report a URC as +QIURC:
"incoming",<connectID>,<serverID>,<remoteIP>,<remote_port>. The range of <connectID> is
0-11. The type of this new incoming connection is "TCP INCOMING" and the <access_mode> of
"TCP INCOMING" is the same with that of "TCP LISTENER".
2. If <service_type> is "UDP SERVICE", UDP data can be sent to or received from the remote IP via
<local_port>.
Send data: execute AT+QISEND=<connectID>,<send_length>,<remoteIP>,<remote_port>.
Receive data in direct push mode: the module reports the URC as +QIURC:
"recv",<connectID>,<currentrecvlength>,<remoteIP>,<remote_port><CR><LF><data>.
Receive data in buffer access mode: the module reports the URC as +QIURC:
"recv",<connectID>, and then data can be retrieved via AT+QIRD=<connectID>.
3. It is suggested to wait for 150 seconds for +QIOPEN: <connectID>,<err> to be outputted. If the URC
cannot be received in 150 seconds after executing the Write Command, AT+QICLOSE should be
used to close the socket.
OK
Write Command Response
AT+QIOPEN=<contextID>,<connectID If the service is in transparent access mode
>,<service_type>,<IP_address>/<dom (<access_mode>=2) and is opened successfully:
ain_name>,<remote_port>[,<local_po CONNECT
rt>[,<access_mode>]]
If there is any error:
LTE_Standard_TCP/IP_Application_Note 13 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
ERROR
Error description can be got via AT+QIGETERROR.
+QIOPEN: <connectID>,<err>
<err> is 0 when the service is opened successfully. In other
cases, <err> is not 0.
Parameter
LTE_Standard_TCP/IP_Application_Note 14 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
NOTE
The command is used to close a specified socket service. Depending on the network, it will take at most
10 seconds (default value, can be modified by <timeout>) to return OK or ERROR after executing
AT+QICLOSE. Before the response is returned, other AT commands cannot be executed.
OK
Write Command Response
AT+QICLOSE=<connectID>[,<timeout If the socket service is closed successfully:
>] OK
Parameter
<connectID> Integer type. The socket service index. The range is 0-11.
<timeout> Integer type. The timeout value for the response to be outputted. If the FIN ACK of the
other peer is not received within <timeout>, the module will be forced to close the
socket. The range is 0-65535, and the default value is 0. Unit: second.
The command is used to query the socket service status. If the <query_type> is 0, it will return the status
of all existing socket services in the specified context. If the <query_type> is 1, it will return the status of a
specified socket service.
LTE_Standard_TCP/IP_Application_Note 15 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
OK
Write Command Response
If <query_type> is 0, query the Return the status of all existing connections in a specified
connection status of a specified context context:
AT+QISTATE=<query_type>,<context +QISTATE: <connectID>,<service_type>,<IP_address>,<r
ID> emote_port>,<local_port>,<socket_state>,<contextID>,<s
erverID>,<access_mode>,<AT_port>
[…]
OK
Write Command Response
If <query_type> is 1, query the +QISTATE: <connectID>,<service_type>,<IP_address>,<r
connection status of a specified socket emote_port>,<local_port>,<socket_state>,<contextID>,<s
service erverID>,<access_mode>,<AT_port>
AT+QISTATE=<query_type>,<connect
ID> OK
Parameter
LTE_Standard_TCP/IP_Application_Note 16 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
NOTE
If the data access mode of a specified socket service is buffer access mode (<access_mode>=0) or
direct push mode (<access_mode>=1), then the data can be sent via this command. When the data is
sent to the module successfully, SEND OK will be returned. Otherwise it will return SEND FAIL or
ERROR. SEND FAIL indicates the sending buffer is full and the data can be tried to be resent. ERROR
indicates it encounters an error in the process of sending data. The data should be delayed for some time
LTE_Standard_TCP/IP_Application_Note 17 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
to be sent. The maximum data length is 1460 bytes. SEND OK does not mean the data has been sent to
the server successfully. Customers can query whether the data has reached the server by
AT+QISEND=<connectID>,0 command.
OK
Write Command Response
Send variable-length data when >
<service_type> is "TCP", "UDP" or After the response >, input the data to be sent. Tap “CTRL+Z”
"TCP INCOMING" to send, and tap Esc to cancel the operation
AT+QISEND=<connectID>
If the connection has been established and the data is sent
successfully:
SEND OK
LTE_Standard_TCP/IP_Application_Note 18 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
OK
Parameter
LTE_Standard_TCP/IP_Application_Note 19 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
NOTE
In buffer access mode, after receiving data, the module will buffer it and report +QIURC:
"recv",<connectID>, then the data can be read by AT+QIRD.
Please note that if the buffer is not empty, and the module receives data again, it will not report a new
URC until all the received data has been read via AT+QIRD from buffer.
OK
Write Command Response
When <service_type> is "TCP", "UDP", If the specified connection has received the data, response:
"TCP INCOMING" or "UDP INCOMING" +QIRD: <read_actual_length><CR><LF><data>
AT+QIRD=<connectID>[,<read_length
>] OK
If there is no data:
+QIRD: 0
OK
OK
If there is no data:
+QIRD: 0
OK
LTE_Standard_TCP/IP_Application_Note 20 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
OK
Parameter
<connectID> Integer type. The socket service index. The range is 0-11.
<read_length> The maximum length of data to be read. The range is 0-1500. Unit: byte.
<read_actual_length> The length of data that has been actually read. Unit: byte.
<remoteIP> String type. The remote IP address. It is valid only when <service_type> is
"UDP SERVICE".
<remote_port> Integer type. Remote port. It is valid only when <service_type> is "UDP
SERVICE".
<data> The data that has been read.
<total_receive_length> The total length of the read data. Unit: byte.
<have_read_length> The length of data that has been read. Unit: byte.
<unread_length> The length of data that has not been read. Unit: byte.
NOTE
This command is used to send hex string data and cannot be applied for "UDP SERVICE" and "TCP
LISTENER" sockets.
OK
LTE_Standard_TCP/IP_Application_Note 21 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Parameter
<connectID> Integer type. The socket service index. The range is 0-11.
<hex_string> String type. Hex string data. The max length is 512 bytes.
The command can be used to switch the data access mode which includes buffer access mode, direct
push mode and transparent access mode. When starting a socket service, the data access mode can be
specified via the <access_mode> parameter of AT+QIOPEN. After a socket has been opened, the data
access mode can be changed via AT+QISWTMD.
OK
Write Command Response
AT+QISWTMD=<connectID>,<access If data access mode is switched successfully and
_mode> <access_mode> is 0 or 1:
OK
LTE_Standard_TCP/IP_Application_Note 22 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Parameter
<connectID> Integer type. The socket service index. The range is 0-11.
<access_mode> Integer type. The data access modes of the connection.
0 Buffer access mode
1 Direct push mode
2 Transparent access mode
The command is used to test the Internet protocol reachability of a host. Before using ping tools, the host
should activate the context corresponding to <contextID> via AT+QIACT first. It will return the result
within <timeout> and the default value of <timeout> is 4 seconds.
OK
Write Command Response
AT+QPING=<contextID>,<host>[,<tim If a remote server is pinged successfully:
eout>[,<pingnum>]] OK
[+QPING: <result>[,<IP_address>,<bytes>,<time>,<ttl>]<C
R><LF>…]
+QPING: <finresult>[,<sent>,<rcvd>,<lost>,<min>,<max>,
<avg>]
Parameter
LTE_Standard_TCP/IP_Application_Note 23 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
by ,<IP_address>,<bytes>,<time>,<ttl>.
Others Please refer to Chapter 4.
<IP_address> The IP address of the remote server formatted as a dotted decimal IP.
<bytes> The length of each sent ping request. Unit: byte.
<time> The time wait for the response of the ping request. Unit: ms.
<ttl> Time to live value of the response packet for the ping request.
<finresult> The final result of the command.
0 It is finished normally. It is successful to activate the context and find the host.
In this case, it is followed by <sent>,<rcvd>,<lost>,<min>,<max>,<avg>.
Others Error codes. Please refer to Chapter 4 for details.
<sent> Total number of the ping requests that have been sent.
<rcvd> Total number of the ping requests that received the response.
<lost> Total number of the ping requests that are time out.
<min> The minimum response time. Unit: ms.
<max> The maximum response time. Unit: ms.
<avg> The average response time. Unit: ms.
This command is used to synchronize the local time with Universal Time Coordinated (UTC) through the
NTP server. Before time synchronization, the host should activate the context corresponding to
<contextID> via AT+QIACT first. Depending on the network, it will take at most 125 seconds to return the
result.
OK
Read command Response
AT+QNTP? If in the process of local time synchronization:
+QNTP: <server>,<port>
OK
Write command Response
AT+QNTP=<contextID>,<server> If the local time is synchronized with NTP server successfully:
[,<port>[,<autosettime>]] OK
+QNTP: <err>,<time>
LTE_Standard_TCP/IP_Application_Note 24 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Parameter
Before setting the DNS address, the host must activate the context corresponding to <contextID> via
AT+QIACT first.
OK
Write Command Response
AT+QIDNSCFG=<contextID>[,<pr If <pridnsaddr> and <secdnsaddr> are omitted, query the
idnsaddr>[,<secdnsaddr>]] current DNS server addresses of a specified PDP context:
+QIDNSCFG: <contextID>,<pridnsaddr>,<secdnsaddr>
OK
Parameter
<contextID> Integer type. The PDP context ID. The range is 1-16.
<pridnsaddr> String type. The primary DNS server address.
<secdnsaddr> String type. The secondary DNS server address.
LTE_Standard_TCP/IP_Application_Note 25 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Before querying the DNS, the host should activate the context corresponding to <contextID> via
AT+QIACT first. Depending on the network, it will take at most 60 seconds to return the result.
OK
Write Command Response
AT+QIDNSGIP=<contextID>,<hos OK
tname>
If there is any error:
ERROR
Parameter
<contextID> Integer type. The PDP context ID. The range is 1-16.
<hostname> String type. The domain name.
<err> Integer type. Error codes of the operation. Please refer to Chapter 4.
<IP_count> Integer type. The number of the IP addresses corresponding to the <hostname>.
<DNS_ttl> Integer type. The time to live of the DNS.
<hostIPaddr> String type. The IP address of <hostname>.
LTE_Standard_TCP/IP_Application_Note 26 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
+QICFG: "dns/cache",(0,1)
+QICFG: "qisend/timeout",(0-3600)
+QICFG: "passiveclosed",(0,1)
+QICFG: "udp/readmode",(0,1)
+QICFG: "udp/sendmode",(0,1)
+QICFG: "tcp/accept",(0,1)
+QICFG: "tcp/keepalive",(0,1),(1-120),(25-100),(3-10)
+QICFG: "recv/buffersize",(10240-524288)
+QICFG: "recvind",(0,1)
OK
Write Command Response
Configure the packet size for [+QICFG: "transpktsize",<transpktsize>]
transparent access mode
AT+QICFG="transpktsize"[,<tran OK
spktsize>]
If there is any error:
ERROR
Write Command Response
Configure the waiting time for [+QICFG: "transwaittm",<transwaittm>]
transparent access mode
AT+QICFG="transwaittm"[,<tran OK
swaittm>]
If there is any error:
ERROR
Write Command Response
Configure the format of the data to [+QICFG:
be sent or received (only for "dataformat",<send_data_format>,<recv_data_format>]
non-transparent mode)
AT+QICFG="dataformat"[,<send OK
_data_format>,<recv_data_forma
t>] If there is any error:
ERROR
Write Command Response
Configure the output format of [+QICFG: "viewmode",<view_mode>]
received data (only for
non-transparent mode) OK
AT+QICFG="viewmode"[,<view_
mode>] If there is any error:
ERROR
Write Command Response
Configure the maximum interval [+QICFG: "tcp/retranscfg",<max_backoffs>,<max_rto>]
time and the times for TCP
retransmission OK
LTE_Standard_TCP/IP_Application_Note 27 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
AT+QICFG="tcp/retranscfg"[,<m
ax_backoffs>,<max_rto>] If there is any error:
ERROR
Write Command Response
Enable or disable the DNS cache [+QICFG: "dns/cache",<dns_cache>]
AT+QICFG="dns/cache"[,dns_ca
che] OK
LTE_Standard_TCP/IP_Application_Note 28 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
ERROR
Parameter
<transpktsize> Integer type. The max length of the data packet to be sent. The range is
1-1460. The default value is 1024. Unit: byte.
<transwaittm> Integer type. In transparent access mode, if the length of data received from
the port is less than the specified value of <transpktsize>, after exceeding
the time of <transwaittm>, data will be sent directly. The range is 0-20, and
the default value is 2. Unit: 100ms.
<send_data_format> Integer type. The format of the data to be sent. The suffix “0x” is not needed
when the mode is set as Hex mode as the module will automatically form two
bytes to one ASCII code.
0 Text mode
1 Hex mode
<recv_data_format> Integer type. The format of the data to be received. The suffix “0x” is not
needed when the mode is set as Hex mode as the module will automatically
form two bytes to one ASCII code.
0 Text mode
1 Hex mode
<view_mode> Integer type. The output format of received data.
LTE_Standard_TCP/IP_Application_Note 29 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
NOTE
LTE_Standard_TCP/IP_Application_Note 30 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
This command is used to control whether to echo the data for AT+QISEND
OK
Read command Response
AT+QISDE? +QISDE: <echo>
OK
Write Command Response
AT+QISDE=<echo> OK
Parameter
If ERROR is returned after executing TCP/IP commands, the details of error can be queried via
AT+QIGETERROR. Please note that AT+QIGETERROR just returns error code of the last TCP/IP AT
command.
OK
LTE_Standard_TCP/IP_Application_Note 31 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Parameter
The URC of TCP/IP AT commands will be reported to the host in the format of beginning with +QIURC:. It
contains the reports about incoming data, connection closed and incoming connection and so on. Actually,
there is <CR><LF> both before and after URC, but <CR><LF> is not presented intentionally.
When TCP socket service is closed by remote peer or due to network error, the URC will be outputted,
and the status of socket service will be “closing” (<socket_state>=4). AT+QICLOSE=<connectID> can
be used to change the <socket_state> to initial.
Parameter
<connectID> Integer type. The socket service index. The range is 0-11.
In buffer access mode or direct push mode, after receiving data, the module will report a URC to the host.
In buffer access mode, after receiving data, the module will report URC as +QIURC: "recv",<connectID>
to notify the host. Then host can retrieve data via AT+QIRD. Please note that if the buffer is not empty,
and the module receives data again, it will not report a new URC until all the received data has been
retrieved via AT+QIRD from buffer.
In direct push mode, the received data will be outputted to COM port directly.
LTE_Standard_TCP/IP_Application_Note 32 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
+QIURC: The URC indicates the incoming data in direct push mode
"recv",<connectID>,<currentrecvleng when the <service_type> is "TCP", "UDP", "UPD INCOMING"
th><CR><LF><data> or "TCP INCOMING".
+QIURC: The URC indicates data incoming in direct push mode when
"recv",<connectID>,<currentrecvleng <service_type> is "UDP SERVICE".
th>,<remoteIP>,<remote_port><CR><
LF><data>
Parameter
<connectID> Integer type. The socket service index. The range is 0-11.
<currentrecvlength> Integer type. The length of actually received data.
<remoteIP> Remote IP address.
<remote_port> Remote port.
<data> The received data.
If the incoming connection reaches the limit, or no socket system resources can be allocated, then the
module will report the URC as +QIURC: "incoming full" for the new incoming connection request.
+QIURC: "incoming full" The URC indicates the incoming connection is full.
NOTE
If the <service_type> is "TCP LISTENER" or "UDP LISTENER", when a remote client connects to this
server, the host will automatically assign a free <connectID> for the new connection. The range of
<connectID> is 0-11. In such a case, the module will report the URC. The <service_type> of the new
connection will be "TCP INCOMING", and the <access_mode> will be buffer access mode.
LTE_Standard_TCP/IP_Application_Note 33 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
Parameter
<connectID> Integer type. Assign this socket service for the incoming connection, which is
automatically specified by the module. The range is 0-11.
<serverID> The incoming <connectID> accepted by the server whose <service_type> is "TCP
LISTENER" or "UDP LISTENER" and listening socket ID is <serverID>.
<remoteIP> Remote IP address of the incoming <connectID>.
<remote_port> Remote port of the incoming <connectID>.
NOTE
PDP context may be deactivated by the network. The module will report the URC to the host about PDP
deactivation. In such a case, the host must execute AT+QIDEACT to deactivate the context and reset all
connections.
Parameter
LTE_Standard_TCP/IP_Application_Note 34 / 47
LTE Standard Module Series
LTE Standard TCP/IP AT Commands Manual
3 Examples
OK
3.2.1. Set up a TCP Client Connection and Enter into Buffer Access Mode
LTE_Standard_TCP/IP_Application_Note 35 / 45
LTE Standard Module Series
LTE Standard TCP/IP Application Note
OK
OK
AT+QISENDEX=0,"3132333435" //Send Hex string data.
SEND OK
AT+QISEND=0,0 //Query the length of sent data, acknowledged data and
unacknowledged data.
+QISEND: 14,14,0
OK
AT+QIRD=0,1500 //Read data, the maximum length of data to be retrieved is 1500 bytes.
+QIRD: 5 //The length of actually received data is 5 bytes.
LTE_Standard_TCP/IP_Application_Note 36 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
test1
OK
AT+QICFG="recvind",1
OK
+QIURC: "recv",0,5 //The <connectID>= 0 received 5 bytes data.
AT+QIRD=0,1500 //Read data, and the length is 1500 bytes.
+QIRD: 5 //The length of actual received data is 5 bytes.
test1
OK
AT+QIRD=0,1500
+QIRD: 0 //No data in buffer.
OK
AT+QIRD=0,0 //Query the total length of received data, including read and unread data.
+QIRD: 10,10,0
OK
3.3.1. Set up a TCP Client Connection and Enter into Transparent Access Mode
LTE_Standard_TCP/IP_Application_Note 37 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
<All data got from COM port will be sent to internet directly>
3.4.1. Set up a TCP Client Connection and Enter into Direct Push Mode
OK
LTE_Standard_TCP/IP_Application_Note 38 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
OK
LTE_Standard_TCP/IP_Application_Note 39 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
<contextID> is 1.
+QISTATE: 1,"TCP LISTENER","10.7.157.1",0,2020,3,1,1,0,"usbmodem"
OK
OK
AT+QIRD=11,1500
+QIRD: 0 //No data in buffer.
OK
AT+QIRD=11,0 //Query the total length of received data, including
read and unread data.
+QIRD: 4,4,0
OK
LTE_Standard_TCP/IP_Application_Note 40 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
OK
OK
AT+QIRD=2 //Read data.
+QIRD: 0 //No data in buffer.
OK
AT+QISEND=2,10,"10.7.76.34",7687 //Send data to the remote whose IP is 10.7.76.34
and remote port is 7687.
LTE_Standard_TCP/IP_Application_Note 41 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
>1234567890
SEND OK
3.7. PING
+QPING: 0,"61.135.169.125",32,192,255
+QPING: 0,"61.135.169.125",32,240,255
+QPING: 0,"61.135.169.125",32,241,255
+QPING: 0,"61.135.169.125",32,479,255
+QPING: 0,4,4,0,192,479,287
+QNTP: 0,"2019/07/21,06:10:59+00"
AT+CCLK?
+CCLK: "19/07/21,06:11:05+00"
LTE_Standard_TCP/IP_Application_Note 42 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
OK
OK
LTE_Standard_TCP/IP_Application_Note 43 / 47
LTE Standard Module Series
LTE Standard TCP/IP AT Commands Manual
<err> Meaning
0 Operation successful
LTE_Standard_TCP/IP_Application_Note 44 / 45
LTE Standard Module Series
LTE Standard TCP/IP Application Note
LTE_Standard_TCP/IP_Application_Note 45 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
5 Appendix A Reference
Abbreviation Description
ACK Acknowledge
CS Circuit Switching
FIN Finish
ID Identify
IP Internet Protocol
NV Non-Volatile
PS Packet Switching
LTE_Standard_TCP/IP_Application_Note 46 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note
LTE_Standard_TCP/IP_Application_Note 47 / 47