0% found this document useful (0 votes)
458 views48 pages

Quectel LTE Standard TCP (IP) Application Note V1.1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
458 views48 pages

Quectel LTE Standard TCP (IP) Application Note V1.1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

LTE Standard TCP/IP

Application Note

LTE Standard Module Series

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:

Quectel Wireless Solutions Co., Ltd.


Building 5, Shanghai Business Park Phase III (Area B), No.1016 Tianlin Road, Minhang District, Shanghai,
China 200233
Tel: +86 21 5108 6236
Email: info@quectel.com

Or our local office. For more information, please visit:


http://www.quectel.com/support/sales.htm

For technical support, or to report documentation errors, please visit:


http://www.quectel.com/support/technical.htm
Or email to: support@quectel.com

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

About the Document

History

Revision Date Author Description

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

About the Document ................................................................................................................................... 2


Contents ....................................................................................................................................................... 3
Table Index ................................................................................................................................................... 5

1 Introduction .......................................................................................................................................... 6
1.1. The Process of Using TCP/IP AT Commands ............................................................................. 6
1.2. Description of Data Access Modes .............................................................................................. 8

2 Description of TCP/IP AT Commands ............................................................................................. 10


2.1. Description of AT Commands .................................................................................................... 10
2.1.1. AT+QICSGP Configure Parameters of a TCP/IP Context .......................................... 10
2.1.2. AT+QIACT Activate a PDP Context ............................................................................ 11
2.1.3. AT+QIDEACT Deactivate a PDP Context ................................................................... 12
2.1.4. AT+QIOPEN Open a Socket Service .......................................................................... 13
2.1.5. AT+QICLOSE Close a Socket Service........................................................................ 15
2.1.6. AT+QISTATE Query Socket Service Status ................................................................ 15
2.1.7. AT+QISEND Send Data .............................................................................................. 17
2.1.8. AT+QIRD Read the Received TCP/IP Data ................................................................ 20
2.1.9. AT+QISENDEX Send Hex String Data........................................................................ 21
2.1.10. AT+QISWTMD Switch Data Access Mode.................................................................. 22
2.1.11. AT+QPING Ping a Remote Server .............................................................................. 23
2.1.12. AT+QNTP Synchronize Local Time with NTP Server ................................................. 24
2.1.13. AT+QIDNSCFG Configure Address of DNS Server ................................................... 25
2.1.14. AT+QIDNSGIP Get IP Address by Domain Name ...................................................... 26
2.1.15. AT+QICFG Configure Optional Parameters ............................................................... 26
2.1.16. AT+QISDE Control Whether to Echo the Data for AT+QISEND................................. 31
2.1.17. AT+QIGETERROR Query the Last Error Code .......................................................... 31
2.2. Description of URCs .................................................................................................................. 32
2.2.1. URC Indicating Connection Closed ............................................................................... 32
2.2.2. URC Indicating Incoming Data....................................................................................... 32
2.2.3. URC Indicating Incoming Connection Full ..................................................................... 33
2.2.4. URC Indicating Incoming Connection ............................................................................ 33
2.2.5. URC Indicating PDP Deactivation.................................................................................. 34

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

3.2.4. Close a Connection ........................................................................................................ 37


3.3. TCP Client Works in Transparent Access Mode ........................................................................ 37
3.3.1. Set up a TCP Client Connection and Enter into Transparent Access Mode ................. 37
3.3.2. Send Data in Transparent Access Mode ....................................................................... 38
3.3.3. Receive Data from Remote Server in Transparent Access Mode ................................. 38
3.3.4. Close a TCP Client ......................................................................................................... 38
3.4. TCP Client Works in Direct Push Mode ..................................................................................... 38
3.4.1. Set up a TCP Client Connection and Enter into Direct Push Mode .............................. 38
3.4.2. Send Data in Direct Push Mode..................................................................................... 39
3.4.3. Receive Data from Remote Server in Direct Push Mode .............................................. 39
3.4.4. Close a TCP Client ......................................................................................................... 39
3.5. TCP Server Works in Buffer Access Mode ................................................................................ 39
3.5.1. Start a TCP Server ......................................................................................................... 39
3.5.2. Accept TCP Incoming Connection ................................................................................. 40
3.5.3. Receive Data from Incoming Connection ...................................................................... 40
3.5.4. Close a TCP Server ....................................................................................................... 40
3.6. Example of UDP Service ........................................................................................................... 41
3.6.1. Start a UDP Service ....................................................................................................... 41
3.6.2. Send UDP Data to Remote ............................................................................................ 41
3.6.3. Receive Data from Remote ............................................................................................ 41
3.6.4. Close a UDP Service ..................................................................................................... 42
3.7. PING........................................................................................................................................... 42
3.8. Synchronize Local Time ............................................................................................................. 42
3.9. Get Last Error Code ................................................................................................................... 43

4 Summary of Error Codes .................................................................................................................. 44

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

TABLE 1: SUMMARY OF ERROR CODES ...................................................................................................... 44


TABLE 2: TERMS AND ABBREVIATIONS ........................................................................................................ 46

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.

This document is applicable to following LTE Standard modules.

 EC2x: EC25, EC21, EC20 R2.0 and EC20 R2.1


 EG2x-G: EG25-G and EG21-G
 EG9x: EG91 and EG95
 EM05

1.1. The Process of Using TCP/IP AT Commands

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

Recommended Power on/off: Power on the module


1. Power off: Send AT+QPOWD command,
and then cut off power after 12s or more.
2. Power on: Keep power key as low for 2s, Send AT command and wait for the module to respond OK
and then pull it to high.

Query (U)SIM Card Status:


If failed to identify (U)SIM
Execute AT+CPIN. Reboot the module if Query (U)SIM card card in 20s, then reboot the
AT+CPIN? fails to identify (U)SIM card in status by AT+CPIN?
module.
20s.

CS Service: Identify (U)SIM card


1. If <stat> of AT+CREG? equals to 1 or 5,
it means that the module has registered on
If failed to register on CS
CS domain service. Query CS service by domain service in 90s,
2. Reboot the module if it fails to register on AT+CREG? then reboot the module.
CS domain service in 90s.

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.

Configure a PDP Context:


1. Configure APN, user name, password Configure the PDP context and Qos by
and auth type by AT+QICSGP. AT+QICSGP/AT+CGQREQ/
2. Configure QoS settings by AT+CGQMIN/ AT+CGEQREQ/AT+CGQMIN/
AT+CGEQMIN/ AT+CGQREQ/ AT+CGEQMIN
AT+CGEQREQ.

Activate a PDP Context: 1. Reboot the module if


1. Activate the PDP context by there is no response in
Reboot the
AT+QIACT=<contextID>. The PDP 150s.
module if Activate the PDP context by
2. Query IP address of the PDP context is 2. If failed to deactivate the
there is no AT+QIACT=<contextID>
context by AT+QIACT?. deactivated PDP context for 3 times
response in and AT+QIACT?
Notes: successfully continuously, then reboot
40s.
a) All above commands should be the module.
executed together in sequence.
b) Reboot the module if there is no Failed to activate
the PDP context Successfully activate PDP context
response for AT+QIACT in 150s.
c) If failed to deactivate the PDP
context for 3 times continuously, Deactivate
then reboot the module. the PDP context by Open connection
3. Deactivate the PDP context: AT+QIDEACT= by AT+QIOPEN
reboot the module if there is no <contextID>
response for AT+QIDEACT in 40s.
1. Failed to open connection
continuously for 5 times. +QIOPEN: <connectID>,<err>
2. There is no response in150s.
Open Connection:
1. If failed to get response of AT+QIOPEN in 150s, then
close connection.
Send data by
2. If failed to open connection for 5 times continuously,
AT+QISEND=<connectID>
deactivate the PDP context first, and then re-activate the
PDP context and open connection again.
Get ACK
in 90s
TCP Connection Maintenance and Detection: Query sending
1. Send data by AT+QISEND =<connectID>[,<send_length>]. ACK by AT+QISEND=
It is recommended to periodically send a small data packet to the remote <connectID>,0
end to maintain and detect the TCP connection.
2. Query sending ACK by AT+QISEND=<connectID>,0.
If the package is still not acknowledged after two minutes (query every 5 Failed to get ACK in 90s
seconds, 24 times in total), the TCP connection may be abnormal.
Execute AT+QICLOSE to close the current connection, and then execute
AT+QIOPEN to re-establish the TCP connection. Close connection
OK
by AT+QICLOSE=
<connectID>
Reboot the module if there is
no response in 10s.

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.

Figure 1: Flow Chart of Using TCP/IP AT Commands

LTE_Standard_TCP/IP_Application_Note 7 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

1.2. Description of Data Access Modes

LTE Standard modules support the following three kinds of data access modes:

 Buffer access mode


 Direct push mode
 Transparent access mode

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.

 Exit from 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:

1) Do not input any character within 1s or longer before inputting +++.


2) Input +++ within 1s, and no other characters can be inputted during the time.
3) Do not input any character within 1s after +++ has been inputted.
4) Use +++ or DTR (AT&D1 should be set first) to make the module exit from transparent access
mode, and wait until OK is returned.

LTE_Standard_TCP/IP_Application_Note 8 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

 Return back to transparent access mode

1) By AT+QISWTMD. Specify the <access_mode> as 2 when executing this command. When


transparent access mode has been entered successfully, CONNECT will be returned.
2) By ATO. After a connection exits from transparent access mode, executing ATO will switch the
data access mode back to transparent access mode again. When transparent access mode has
been entered successfully, CONNECT will be returned. If no connection has entered transparent
access mode before, ATO will return NO CARRIER.

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

2 Description of TCP/IP AT Commands

2.1. Description of AT Commands

2.1.1. AT+QICSGP Configure Parameters of a TCP/IP Context

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.

AT+QICSGP Configure Parameters of a TCP/IP Context


Test Command Response
AT+QICSGP=? +QICSGP: (1-16),(1-3),<APN>,<username>,<password>,
(0-3),(0-1)

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

<contextID> Integer type. The context ID. The range is 1-16.


<context_type> Integer type. The protocol type.
1 IPv4
2 IPv6
3 IPv4v6
<APN> String type. The access point name.
<username> String type. The username. The maximum length is 127 bytes.

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

AT+QICSGP=1 //Query the configuration of context 1.


+QICSGP: 1,"","","",0

OK
AT+QICSGP=1,1,"UNINET","","",1 //Configure context 1. APN is "UNINET" for China Unicom.
OK

2.1.2. AT+QIACT Activate a PDP Context

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.

AT+QIACT Activate a PDP Context


Test Command Response
AT+QIACT=? +QIACT: (1-16)

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

Write Command Response


Activate a specified PDP context Activate the specified context:
AT+QIACT=<contextID> OK

If there is any error:


ERROR

Maximum Response Time 150 seconds, determined by the network.

Parameter

<contextID> Integer type. The context ID. The range is 1-16.


<context_state> Integer type. The context state.
0 Deactivated
1 Activated
<context_type> Integer type. The protocol type.
1 IPv4
2 IPv6
3 IPv4v6
<IP_address> The local IP address after the context is activated.

2.1.3. AT+QIDEACT Deactivate a PDP Context

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.

AT+QIDEACT Deactivate a PDP Context


Test Command Response
AT+QIDEACT=? +QIDEACT: (1-16)

OK
Write Command Response
AT+QIDEACT=<contextID> OK

If there is any error:


ERROR

Maximum Response Time 40 seconds, determined the network.

LTE_Standard_TCP/IP_Application_Note 12 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

Parameter

<contextID> Integer type. The context ID. The range is 1-16.

2.1.4. AT+QIOPEN Open a Socket Service

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.

AT+QIOPEN Open a Socket Service


Test Command Response
AT+QIOPEN=? +QIOPEN: (1-16),(0-11),"TCP/UDP/TCP LISTENER/UDP
SERVICE","<IP_address>/<domain_name>",<remote_port
>,<local_port>,(0-2)

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.

If the service is in buffer access mode (<access_mode>=0) or


direct push mode (<access_mode>=1):
OK

+QIOPEN: <connectID>,<err>
<err> is 0 when the service is opened successfully. In other
cases, <err> is not 0.

Maximum Response Time 150 seconds, determined by the network.

Parameter

<contextID> Integer type. Context ID. The range is 1-16.


<connectID> Integer type. Socket service index. The range is 0-11.
<service_type> String type. Socket service type.
"TCP" Start a TCP connection as a client
"UDP" Start a UDP connection as a client
"TCP SERVICE" Start a TCP service.
"TCP LISTENER" Start a TCP server to listen to TCP connection
"UDP SERVICE" Start a UDP service
"UDP LISTENER" Start a UDP server to listen to UDP connection
<IP_address> String type.
If <service_type> is "TCP" or "UDP", it indicates the IP address of remote server,
such as 220.180.239.212.
If <service_type> is "TCP LISTENER" or "UDP SERVICE", please enter 127.0.0.1.
<domain_name> String type. The domain name address of the remote server.
<remote_port> The port of the remote server. The range is 0-65535.
It must be specified when <service_type> is "TCP" or "UDP".
<local_port> The local port. The range is 0-65535.
If <service_type> is "TCP LISTENER" or "UDP SERVICE", this parameter must be
specified.
If <service_type> is "TCP" or "UDP", the local port will be assigned automatically if
<local_port> is 0. Otherwise the local port is assigned as specified.
<access_mode> Integer type. The data access mode of the socket service.
0 Buffer access mode
1 Direct push mode
2 Transparent access mode
<err> Integer type. Error codes of the operation. Please refer to Chapter 4.

LTE_Standard_TCP/IP_Application_Note 14 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

NOTE

"UDP LISTENER" of <service_type> is only supported by EG95 and EG91 modules.

2.1.5. AT+QICLOSE Close a Socket Service

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.

AT+QICLOSE Close a Socket Service


Test Command Response
AT+QICLOSE=? +QICLOSE: (0-11),(0-65535)

OK
Write Command Response
AT+QICLOSE=<connectID>[,<timeout If the socket service is closed successfully:
>] OK

If it is failed to close the socket service:


ERROR

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.

2.1.6. AT+QISTATE Query Socket Service Status

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.

AT+QISTATE Query Socket Service Status


Test Command Response
AT+QISTATE=? OK

LTE_Standard_TCP/IP_Application_Note 15 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

Read/Execution Command Response


AT+QISTATE? or AT+QISTATE Return the status of all existing connections:
+QISTATE: <connectID>,<service_type>,<IP_address>,<r
emote_port>,<local_port>,<socket_state>,<contextID>,<s
erverID>,<access_mode>,<AT_port>
[…]

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

<query_type> Integer type. The query type.


0 Query connection status of all socket services in a specified context
1 Query connection status of a specified socket service
<contextID> Integer type. The context ID. The range is 1-16.
<connectID> Integer type. The socket service index. The range is 0-11.
<service_type> String type. The socket service type.
"TCP" Start a TCP connection as a client
"UDP" Start a UDP connection as a client
"TCP SERVICE" Start a TCP service
"TCP LISTENER" Start a TCP server to listen to TCP connection
"TCP INCOMING" Start a TCP connection accepted by a TCP server
"UDP SERVICE" Start a UDP service
"UDP LISTENER" Start a UDP server to listen to UDP connection
"UDP INCOMING" Start a UDP connection accepted by a UDP server
<IP_address> IP address.
If <service_type>="TCP" or "UDP", it is the IP address of remote server.
If <service_type>="TCP LISTENER" or "UDP SERVICE", it is the local IP address.

LTE_Standard_TCP/IP_Application_Note 16 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

If <service_type>="TCP INCOMING" or "UDP INCOMING", it is the IP address of


remote client.
<remote_port> Remote port number.
If <service_type>="TCP" or "UDP", it is the port of remote server.
If <service_type>="TCP LISTENER" or "UDP SERVICE", the port is invalid.
If <service_type>="TCP INCOMING" or "UDP INCOMING", it is the port of remote
client.
<local_port> Local port number.
If <local_port> is 0, then the local port is assigned automatically.
<socket_state> Integer type. The socket service status.
0 "Initial": connection has not been established
1 "Opening": client is connecting or server is trying to listen
2 "Connected": client/incoming connection has been established
3 "Listening": server is listening
4 "Closing": connection is closing
<serverID> It is valid only when <service_type> is "TCP INCOMING". <serverID> represents
which server accepts this TCP incoming connection, and the value is the same as
<connectID> of this server’s "TCP LISTENER".
<access_mode> Data access mode.
0 Buffer access mode
1 Direct push mode
2 Transparent access mode
<AT_port> String type. COM port of socket service.
"usbmodem" USB modem port
"usbat" USB AT port
"uart1" UART port1
"cmux1" MUX port 1
"cmux2" MUX port 2
"cmux3" MUX port 3
"cmux4" MUX port 4

NOTE

"UDP LISTENER" of <service_type> is only supported by EG95 and EG91 modules.

2.1.7. AT+QISEND Send Data

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.

AT+QISEND Send Data


Test Command Response
AT+QISEND=? +QISEND: (0-11),(0-1460)

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

If the connection has been established and the data is sent


successfully:
SEND FAIL

If the connection has been established but the sending buffer


is full:
ERROR
Write Command Response
Send fixed-length data when >
<service_type> is "TCP", "UDP" or After the response >, input the data until the data length equals
"TCP INCOMING" to <send_length>.
AT+QISEND=<connectID>,<send_len
gth> If the connection has been established and the data is sent
successfully:
SEND OK

If the connection has been established but the sending buffer


is full:
SEND FAIL

If the connection has not been established, abnormally closed,


or any parameter is incorrect:
ERROR
Write Command Response
If <service_type> is "UDP SERVICE" This command is used to send fixed length data to a specified

LTE_Standard_TCP/IP_Application_Note 18 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

AT+QISEND=<connectID>,<send_len remote IP address and remote port. The <service_type> must


gth>,<remoteIP>,<remote_port> be "UDP SERVICE".
>
After the response >, input the data until the data length equals
to <send_length>

If the connection has been established and the data is sent


successfully:
SEND OK

If the connection has been established but the sending buffer


is full:
SEND FAIL

If the connection has not been established, abnormally closed,


or any parameter is incorrect:
ERROR
Write Command Response
When <send_length> is 0, query the If the specified connection exists:
sent data +QISEND: <total_send_length>,<ackedbytes>,<unackedb
AT+QISEND=<connectID>,0 ytes>

OK

If there is any error:


ERROR

Parameter

<connectID> Integer type. Socket service index. The range is 0-11.


<send_length> Integer type. The length of data to be sent, which cannot exceed 1460 bytes.
<remoteIP> String type. The remote IP address (must be dot format). It is valid only when
<service_type> is "UDP SERVICE".
<remote_port> Integer type. Remote port. It is only valid when <service_type> is "UDP
SERVICE".
<total_send_length> Integer type. The total length of sent data. Unit: byte.
<ackedbytes> Integer type. The total length of acknowledged data. Unit: byte.
<unackedbytes> Integer type. The total length of unacknowledged data. Unit: byte.
<err> Integer type. Error codes of the operation. Please refer to Chapter 4.

LTE_Standard_TCP/IP_Application_Note 19 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

NOTE

"UDP LISTENER" of <service_type> is only supported by EG95 and EG91 modules.

2.1.8. AT+QIRD Read the Received TCP/IP Data

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.

AT+QIRD Read the Received TCP/IP Data


Test Command Response
AT+QIRD=? +QIRD: (0-11),(0-1500)

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

If the connection does not exist:


ERROR
Write Command Response
When <service_type> is If data exists:
"UDP SERVICE" +QIRD: <read_actual_length>,<remoteIP>,<remote_port>
AT+QIRD=<connectID> <CR><LF><data>

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

If the connection does not exist:


ERROR
Write Command Response
When <read_length> is 0, query the If the specified connection exists:
retrieved data length +QIRD: <total_receive_length>,<have_read_length>,<unre
AT+QIRD=<connectID>,0 ad_length>

OK

If there is any error:


ERROR

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

"UDP LISTENER" of <service_type> is only supported by EG95 and EG91 modules.

2.1.9. AT+QISENDEX Send Hex String Data

This command is used to send hex string data and cannot be applied for "UDP SERVICE" and "TCP
LISTENER" sockets.

AT+QISENDEX Send Hex String Data


Test Command Response
AT+QISENDEX=? +QISENDEX: (0-11),<hex_string>

OK

LTE_Standard_TCP/IP_Application_Note 21 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

Write Command Response


AT+QISENDEX=<connectID>,<h If the hex string is sent successfully:
ex_string> SEND OK

If the sending buffer is full:


SEND FAIL

If the connection does not exist:


ERROR

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.

2.1.10. AT+QISWTMD Switch Data Access Mode

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.

AT+QISWTMD Switch Data Access Mode


Test Command Response
AT+QISWTMD=? +QISWTMD: (0-11),(0-2)

OK
Write Command Response
AT+QISWTMD=<connectID>,<access If data access mode is switched successfully and
_mode> <access_mode> is 0 or 1:
OK

If data access mode is switched successfully and


<access_mode> is 2, the module will enter into data mode:
CONNECT

If there is any error:


ERROR

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

2.1.11. AT+QPING Ping a Remote Server

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.

AT+QPING Ping a Remote Server


Test Command Response
AT+QPING=? +QPING: (1-16),<host>,(1-255),(1-10)

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>]

If there is any error:


ERROR

Parameter

<contextID> Integer type. The context ID. The range is 1-16.


<host> The host address in string type. The format is a domain name or a dotted decimal IP
address.
<timeout> Integer type. Set the maximum time to wait for the response of each ping request. The
range is 1-255, and the default value is 4. Unit: second.
<pingnum> Integer type. Set the maximum number of times for sending ping request. The range is
1-10, and the default value is 4.
<result> The result of each ping request.
0 Received the ping response from the server. In this case, it is followed

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.

2.1.12. AT+QNTP Synchronize Local Time with NTP Server

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.

AT+QNTP Synchronize Local Time with NTP Server


Test command Response
AT+QNTP=? +QNTP: (1-16),<server>,(list of supported <port>s),(0,1)

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>

If there is any error:


ERROR
Maximum Response Time 125s, determined by the network.

LTE_Standard_TCP/IP_Application_Note 24 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

Parameter

<contextID> Integer type. The context ID. The range is 1-16.


<server> String type. The address of NTP server.
<port> Integer type. The port of NTP server. The range is 1-65535.
<autosettime> Integer type. Whether to automatically set synchronized time as local time.
0 Not set
1 Set
<err> Integer type. Error codes of the operation. Please refer to Chapter 4 for details.
<time> String type. The time synchronized from NTP server.
The format is “YYYY/MM/DD,hh:mm:sszz”. The range of zz is -48~+56.

2.1.13. AT+QIDNSCFG Configure Address of DNS Server

Before setting the DNS address, the host must activate the context corresponding to <contextID> via
AT+QIACT first.

AT+QIDNSCFG Configure Address of DNS Server


Test command Response
AT+QIDNSCFG=? +QIDNSCFG: (1-16),<pridnsaddr>,<secdnsaddr>

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

If <pridnsaddr> and <secdnsaddr> are present, configure the


primary and secondary DNS server addresses of a specified PDP
context:
OK

If there is any error:


ERROR

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

2.1.14. AT+QIDNSGIP Get IP Address by Domain Name

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.

.AT+QIDNSGIP Get IP Address by Domain Name


Test Command Response
AT+QIDNSGIP=? +QIDNSGIP: (1-16),<hostname>

OK
Write Command Response
AT+QIDNSGIP=<contextID>,<hos OK
tname>
If there is any error:
ERROR

The result will be returned as URC.


+QIURC: "dnsgip",<err>,<IP_count>,<DNS_ttl>
[.....
+QIURC: "dnsgip",<hostIPaddr>]

Maximum Response Time 60s, determined by the network.

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>.

2.1.15. AT+QICFG Configure Optional Parameters

The command is used to configure optional parameters.

AT+QICFG Configure Optional Parameters


Test Command Response
AT+QICFG=? +QICFG: "transpktsize",(1-1460)
+QICFG: "transwaittm",(0-20)
+QICFG: "dataformat",(0,1),(0,1)
+QICFG: "viewmode",(0,1)
+QICFG: "tcp/retranscfg",(3-20),(5-1000)

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

If there is any error:


ERROR
Write Command Response
Configure the input data timeout [+QICFG: "qisend/timeout",<time>]
AT+QICFG="qisend/timeout"[,ti
me] OK

If there is any error:


ERROR
Write Command Response
Enable or disable the passive close [+QICFG: "passiveclosed",<closed>]
of TCP connection when the server
is closed OK
AT+QICFG="passiveclosed"[,clo
sed] If there is any error:
ERROR
Write Command Response
Read UDP data mode [+QICFG: "udp/readmode",<mode>]
AT+QICFG="udp/readmode"[,mo
de] OK

If there is any error:


ERROR
Write Command Response
Send UDP data mode [+QICFG: "udp/sendmode",<mode>]
AT+QICFG="udp/sendmode"[,m
ode] OK

If there is any error:


ERROR
Write Command Response
Enable or disable the automatic [+QICFG: "tcp/accept",<state>]
reception of the TCP connection
from the client OK
AT+QICFG="tcp/accept"[,state]
If there is any error:

LTE_Standard_TCP/IP_Application_Note 28 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

ERROR

Write Command Response


Send TCP keepalive ["tcp/keepalive",<enable>[<idle_time>,<interval_time>,<prob
AT+QICFG="tcp/keepalive",<en e_cnt>]
able>[,<idle_time>,<interval_ti
me>,<probe_cnt>] OK

If there is any error:


ERROR
Write Command Response
Set receive buffer size [+QICFG: "recv/buffersize",<recv_buffersize>]
AT+QICFG="recv/buffersize"[,<r
ecv_buffersize>] OK

If there is any error:


ERROR
Write Command Response
Configure the URC format of [+QICFG: "recvind",<enable>]
TCP/IP buffer mode
AT+QICFG="recvind"[,enable] OK

If there is any error:


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

0 Output format of received data: data header\r\ndata.


1 Output format of received data: data header,data.
<max_backoffs> Integer type. The maximum number of TCP retransmission. The range is
3-20, and the default value is 12.
<max_rto> Integer type. The maximum interval time of TCP retransmission.
The range is 5-1000, and the default value is 600. Unit: 100ms.
<dns_cache> Integer type.
1 Disable DNS cache
1 Enable DNS cache
<time> Integer type. The timeout period of AT+QISEND. After response >, if no data
is inputted within the timeout period, AT+QISEND command will be exited.
The range is 0-3600, and the default is 0. Unit: ms.
<closed> Integer type.
0 Disable the passive close of TCP connection when the server is closed.
1 Enable the passive close of TCP connection when the server is closed.
<mode> Integer type.
0 Disable block mode.
1 Enable stream mode.
<state> Integer type.
0 Disable auto accepting incoming TCP connection from the client.
1 Enable auto accepting incoming TCP connection from the client.
<enable> Integer type. In command AT+QICFG="tcp/keepalive", it means whether to
send TCP keepalive. In command AT+QICFG="recvind", it means whether
to configure the URC format of TCP/IP buffer access mode
0 Disable corresponding function
1 Enable corresponding function
<idle_time> Integer type. Indicates the cycle time of keepalive triggered, the range is
1-120, Unit: min
<interval_time> Integer type. Indicates the interval of send a packet in a cycle time, the
range is 25-100, Unit: seconds.
<probe_cnt> Integer type. Indicates the cnt of packet send in a cycle time, the range is
3-10.
<recv_buffersize> Integer type. The recv buffer size of TCPIP, the range is 10240- 524288, and
the default is 10240, Unit: bytes.

NOTE

The setting of AT+QICFG="tcp/retranscfg"[,<max_backoffs>,<max_rto>] will take effect to all TCP


sockets and cannot be saved to NV.

LTE_Standard_TCP/IP_Application_Note 30 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

2.1.16. AT+QISDE Control Whether to Echo the Data for AT+QISEND

This command is used to control whether to echo the data for AT+QISEND

AT+QISDE Control Whether to Echo the Data for AT+QISEND


Test command Response
AT+QISDE=? +QISDE: (0,1)

OK
Read command Response
AT+QISDE? +QISDE: <echo>

OK
Write Command Response
AT+QISDE=<echo> OK

If there is any error:


ERROR

Parameter

<echo> Numeric type. Whether to echo the data for AT+QISEND


0 Not echo the data
1 Echo the data

2.1.17. AT+QIGETERROR Query the Last Error Code

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.

AT+QIGETERROR Query the Last Error Code


Test command Response
AT+QIGETERROR=? OK
Execution Command Response
AT+QIGETERROR +QIGETERROR: <err>,<errcode_description>

OK

LTE_Standard_TCP/IP_Application_Note 31 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

Parameter

<err> Integer type.Error codes of the operation. Please refer to Chapter 4.


<errcode_description> A string parameter indicates the details of error information. Please refer to
Chapter 4 for details.

2.2. Description of URCs

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.

2.2.1. URC Indicating Connection Closed

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.

URC Indicating Connection Closed


+QIURC: "closed",<connectID> Socket service connection is closed.

Parameter

<connectID> Integer type. The socket service index. The range is 0-11.

2.2.2. URC Indicating Incoming Data

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.

URC Indicating Incoming Data


+QIURC: "recv",<connectID> The URC indicates the incoming data in buffer access mode.
The host can receive data via AT+QIRD.

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.

2.2.3. URC Indicating Incoming Connection Full

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.

URC Indicating Incoming Connection Full

+QIURC: "incoming full" The URC indicates the incoming connection is full.

NOTE

"UDP LISTENER" of <service_type> is only supported by EG95 and EG91 modules.

2.2.4. URC Indicating Incoming Connection

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.

URC of Incoming Connection


+QIURC: "incoming",<connectID>,<s When the new incoming connection is accepted by
erverID>,<remoteIP>,<remote_port> <serverID>, the allocated <connectID>, <remoteIP> and
<remote_port> will be informed by this URC.

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

"UDP LISTENER" of <service_type> is only supported by EG95 and EG91 modules.

2.2.5. URC Indicating PDP Deactivation

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.

URC of PDP Deactivation


+QIURC: "pdpdeact",<contextID> <contextID> context is deactivated.

Parameter

<contextID> Integer type. The context ID. The range is 1-16.

LTE_Standard_TCP/IP_Application_Note 34 / 47
LTE Standard Module Series
LTE Standard TCP/IP AT Commands Manual

3 Examples

3.1. Configure and Activate a Context

3.1.1. Configure a Context

AT+QICSGP=1,1,"UNINET","","",1 //Configure context 1. APN is "UNINET" for China Unicom.


OK

3.1.2. Activate a Context

AT+QIACT=1 //Activate context 1. Depending on the network, the maximum


response time is 150s.
OK //Activated the context successfully.
AT+QIACT? //Query the context state.
+QIACT: 1,1,1,"10.7.157.1"

OK

3.1.3. Deactivate a Context

AT+QIDEACT=1 //Deactivate context 1.


OK //Deactivated the context successfully. Depending on the
network, the maximum response time is 40s.

3.2. TCP Client Works in Buffer Access Mode

3.2.1. Set up a TCP Client Connection and Enter into Buffer Access Mode

AT+QIOPEN=1,0,"TCP","220.180.239.212",8009,0,0 //Context is 1 and <connectID> is 0. Before


using AT+QIOPEN, the host should activate
the context with AT+QIACT first.
OK

LTE_Standard_TCP/IP_Application_Note 35 / 45
LTE Standard Module Series
LTE Standard TCP/IP Application Note

+QIOPEN: 0,0 //TCP client is connected successfully. It is


suggested to wait for 150 seconds for the
URC response as +QIOPEN:
<connectID>,<err>. If the URC response
cannot be received in 150 seconds, the host
could use AT+QICLOSE to close the socket.
AT+QISTATE=1,0 //Query the connection status of socket service
1.
+QISTATE: 0,"TCP","220.180.239.201",8009,65514,2,1,0,0,"usbmodem"

OK

3.2.2. Send Data in Buffer Access Mode

AT+QISEND=0 //Send variable-length data.


> test1<ctrl+Z>
SEND OK //SEND OK does not mean the data has been sent to the server
successfully. The host can query whether the data has reached the
server via AT+QISEND=0,0.

AT+QISEND=0,4 //Send fixed-length data and the data length is 4 bytes.


> test
SEND OK
AT+QISEND=0,0 //Query the length of sent data.
+QISEND: 9,9,0

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

3.2.3. Receive Data from Remote Server in Buffer Access Mode

+QIURC: "recv",0 //The received data when <connectID>=0.

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.2.4. Close a Connection

AT+QICLOSE=0 //Close a connection whose <connectID> is 0. Depending on the


network, the maximum response time is 10s.
OK

3.3. TCP Client Works in Transparent Access Mode

3.3.1. Set up a TCP Client Connection and Enter into Transparent Access Mode

AT+QIOPEN=1,0,"TCP","220.180.239.212",8009,0,2 //Context is 1 and <connectID> is 0. Before


using AT+QIOPEN, the host should activate the
context with AT+QIACT first.
CONNECT //TCP client is connected successfully. It is
suggested to wait for 150 seconds for the URC
response as CONNECT. If the URC response
cannot be received in 150 seconds, the host
could use AT+QICLOSE to close the socket.

LTE_Standard_TCP/IP_Application_Note 37 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

3.3.2. Send Data in Transparent Access Mode

<All data got from COM port will be sent to internet directly>

3.3.3. Receive Data from Remote Server in Transparent Access Mode

Test 1 //All data received from internet will be outputted via


COM port directly.

3.3.4. Close a TCP Client

AT+QICLOSE=0 //After using +++ to exit from the transparent access


mode, the host could use AT+QICLOSE to close the
TCP link. Depending on the network, the maximum
response time is 10s.
OK

3.4. TCP Client Works in Direct Push Mode

3.4.1. Set up a TCP Client Connection and Enter into Direct Push Mode

AT+QIOPEN=1,0,"TCP","220.180.239.212",8009,0,1 //Context is 1 and <connectID> is 0. Before


using AT+QIOPEN, the host should activate
the context via AT+QIACT first.
OK

+QIOPEN: 0,0 //TCP client is connected successfully. It is


suggested to wait for 150 seconds for the URC
response as +QIOPEN: <connectID>,<err>. If
the URC response cannot be received in 150
seconds, the host could use AT+QICLOSE to
close the socket.
AT+QISTATE=1,0 //Query if the connection state of <connectID> is
0.
+QISTATE: 0,"TCP","220.180.239.201",8009,65344,2,1,0,1,"usbmodem"

OK

LTE_Standard_TCP/IP_Application_Note 38 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

3.4.2. Send Data in Direct Push Mode

AT+QISEND=0 //Send variable-length data.


> test1<ctrl+Z>
SEND OK //SEND OK does not mean the data has been sent to
the server successfully. Host can query whether the
data has reached the server via AT+QISEND=0,0.
AT+QISEND=0,5 //Send fixed length data and the data length is 5 bytes.
> test2
SEND OK
AT+QISEND=0,0 //Query the length of sent data, acknowledged data and
unacknowledged data.
+QISEND: 10,10,0

OK

3.4.3. Receive Data from Remote Server in Direct Push Mode

+QIURC: "recv",0,4 //Receive data from remote server.


test

3.4.4. Close a TCP Client

AT+QICLOSE=0 //Close the connection whose <connectID> is 0.


Depending on the network, the maximum response time
is 10s.
OK

3.5. TCP Server Works in Buffer Access Mode

3.5.1. Start a TCP Server

AT+QIOPEN=1,1,"TCP LISTENER","127.0.0.1",0,2020,0 //Context is 1 and <connectID> is 1. Before


using AT+QIOPEN, the host should
activate the context with AT+QIACT first.
OK

+QIOPEN: 1,0 //TCP server is opened successfully.


AT+QISTATE=0,1 //Query whether the connection state of

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

3.5.2. Accept TCP Incoming Connection

+QIURC: "incoming",11,1,"172.31.242.222",54091 //Accept a TCP connection. The <service_type>


is "TCP incoming", and <connectID> is 11.

3.5.3. Receive Data from Incoming Connection

+QIURC: "recv",11 //Receive data from remote incoming connection.


AT+QIRD=11,1500 //Read data received from incoming connection.
+QIRD: 4 //Actual data length is 4 bytes.
test

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

3.5.4. Close a TCP Server

AT+QICLOSE=11 //Close the incoming connection. Depending on


the network, the maximum response time is 10s.
OK
AT+QICLOSE=1 //Close TCP server listening.
OK

LTE_Standard_TCP/IP_Application_Note 40 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

3.6. Example of UDP Service

3.6.1. Start a UDP Service

AT+QIOPEN=1,2,"UDP SERVICE","127.0.0.1",0,3030,0 //Start a UDP service. The <connectID> is 2


and <contextID> is 1. Before using
AT+QIOPEN, the host should activate the
context with AT+QIACT first.
OK

+QIOPEN: 2,0 //UDP service is opened successfully.


AT+QISTATE=0,1 //Query if the connection status of <contextID>
is 1.
+QISTATE: 2,"UDP SERVICE","10.7.157.1",0,3030,2,1,2,0,"usbmodem"

OK

3.6.2. Send UDP Data to Remote

AT+QISEND=2,10,"10.7.89.10",6969 //Send 10 bytes data to remote whose IP is


10.7.89.10 and the remote port is 6969.
>1234567890
SEND OK

3.6.3. Receive Data from Remote

+QIURC: "recv",2 //Receive data from remote.


AT+QIRD=2 //Read UDP data. One whole UDP packet will be
outputted. There is no need to specify the read
length.
+QIRD: 4,"10.7.76.34",7687 //Data length is 4. The remote IP address is
10.7.76.34 and remote port is 7687.
AAAA

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.6.4. Close a UDP Service

AT+QICLOSE=2 //Close the service.


OK

3.7. PING

AT+QPING=1,"www.baidu.com" //Ping www.baidu.com in context 1. Before pinging


the destination IP address, the host should activate
the context by AT+QIACT first.
OK

+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

3.8. Synchronize Local Time

AT+QNTP=1,"202.112.10.36",123 //Synchronize local time with NTP server


"202.112.10.36:123". Before synchronizing the
time, the host should activate the context with
AT+QIACT first.
OK

+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

3.9. Get Last Error Code

AT+QIOPEN=1,"TCP","220.180.239.212",8009,0,1 //Start a socket service, and <connectID> is not


specified.
ERROR
AT+QIGETERROR
+QIGETERROR: 552, invalid parameters

OK

LTE_Standard_TCP/IP_Application_Note 43 / 47
LTE Standard Module Series
LTE Standard TCP/IP AT Commands Manual

4 Summary of Error Codes


If an ERROR is returned after executing TCP/IP AT 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.

Table 1: Summary of Error Codes

<err> Meaning

0 Operation successful

550 Unknown error

551 Operation blocked

552 Invalid parameters

553 Memory not enough

554 Create socket failed

555 Operation not supported

556 Socket bind failed

557 Socket listen failed

558 Socket write failed

559 Socket read failed

560 Socket accept failed

561 Open PDP context failed

562 Close PDP context failed

563 Socket identity has been used

564 DNS busy

LTE_Standard_TCP/IP_Application_Note 44 / 45
LTE Standard Module Series
LTE Standard TCP/IP Application Note

565 DNS parse failed

566 Socket connect failed

567 Socket has been closed

568 Operation busy

569 Operation timeout

570 PDP context broken down

571 Cancel send

572 Operation not allowed

573 APN not configured

574 Port busy

LTE_Standard_TCP/IP_Application_Note 45 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

5 Appendix A Reference

Table 2: Terms and Abbreviations

Abbreviation Description

3GPP 3rd Generation Partnership Project

ACK Acknowledge

APN Access Point Name

ASCII American Standard Code for Information Interchange

CHAP Challenge Handshake Authentication Protocol

CS Circuit Switching

DNS Domain Name System

FIN Finish

ID Identify

IP Internet Protocol

NTP Network Time Protocol

NV Non-Volatile

PAP Password Authentication Protocol l

PDP Packet Data Protocol

PPP Point-to-Point Protocol

PS Packet Switching

QoS Quality of Service

TCP Transmission Control Protocol

TCP/IP Transmission Control Protocol/Internet Protocol

UART Universal Asynchronous Receiver& Transmitter

LTE_Standard_TCP/IP_Application_Note 46 / 47
LTE Standard Module Series
LTE Standard TCP/IP Application Note

UDP User Datagram Protocol

URC Unsolicited Result Code

USB Universal Serial Bus

(U)SIM (Universal) Subscriber Identity Module

UTC Coordinated Universal Time

LTE_Standard_TCP/IP_Application_Note 47 / 47

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy