Quectel BG96 TCP(IP) AT Commands Manual V1.0

Quectel_BG96_TCP(IP)_AT_Commands_Manual_V1.0

Quectel_BG96_TCP(IP)_AT_Commands_Manual_V1.0

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 43

DownloadQuectel BG96 TCP(IP) AT Commands Manual V1.0
Open PDF In BrowserView PDF
BG96 TCP/IP
AT Commands Manual
LTE Module Series
Rev. BG96_TCP/IP_AT_Commands_Manual_V1.0
Date: 2017-11-23
Status: Released

www.quectel.com

LTE Module Series
BG96 TCP/IP AT Commands Manual

Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:
Quectel Wireless Solutions Co., Ltd.
7th Floor, Hongye Building, No.1801 Hongmei Road, Xuhui District, Shanghai 200233, China
Tel: +86 21 5108 6236
Email: info@quectel.com

Or our local office. For more information, please visit:
http://quectel.com/support/sales.htm

For technical support, or to report documentation errors, please visit:
http://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. 2017. All rights reserved.

BG96_TCP/IP_AT_Commands_Manual

1 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

About the Document
History
Revision

Date

Author

Description

1.0

2017-11-23

Walker HAN/
Lucifer YAN

Initial

BG96_TCP/IP_AT_Commands_Manual

2 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

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 Retrieve the Received TCP/IP Data ........................................................... 19
2.1.9. AT+QISENDEX Send Hex String ................................................................................ 21
2.1.10. AT+QISWTMD Switch Data Access Modes ................................................................ 21
2.1.11. AT+QPING Ping a Remote Server .............................................................................. 22
2.1.12. AT+QNTP Synchronize Local Time with NTP Server ................................................. 23
2.1.13. AT+QIDNSCFG Configure Address of DNS Server ................................................... 24
2.1.14. AT+QIDNSGIP Get IP Address by Domain Name ...................................................... 25
2.1.15. AT+QICFG Configure Optional Parameters ............................................................... 26
2.1.16. AT+QISDE Control Whether to Echo the Data for AT+QISEND ................................. 27
2.1.17. AT+QIGETERROR Query the Last Error Code .......................................................... 28
2.2. Description of URC .................................................................................................................... 28
2.2.1. URC of Connection Closed ............................................................................................ 29
2.2.2. URC of Incoming Data ................................................................................................... 29
2.2.3. URC of Incoming Connection Full.................................................................................. 30
2.2.4. URC of Incoming Connection ........................................................................................ 30
2.2.5. URC of PDP Deactivation .............................................................................................. 30

3

Examples ............................................................................................................................................ 32
3.1. Configure and Activate a Context .............................................................................................. 32
3.1.1. Configure a Context ....................................................................................................... 32
3.1.2. Activate a Context .......................................................................................................... 32
3.1.3. Deactivate a Context ...................................................................................................... 32
3.2. TCP Client Works in Buffer Access Mode ................................................................................. 33
3.2.1. Set up a TCP Client Connection and Enter into Buffer Access Mode ........................... 33
3.2.2. Send Data in Buffer Access Mode ................................................................................. 33
3.2.3. Receive Data from Remote Server in Buffer Access Mode ........................................... 34

BG96_TCP/IP_AT_Commands_Manual

3 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

3.3.

3.4.

3.5.

3.6.

3.7.
3.8.
3.9.
4
5

3.2.4. Close a Connection ........................................................................................................ 34
TCP Client Works in Transparent Access Mode ........................................................................ 34
3.3.1. Set up a TCP Client Connection and Enter into Transparent Access Mode ................. 34
3.3.2. Send Data in Transparent Access Mode ....................................................................... 34
3.3.3. Receive Data from Remote Server in Transparent Access Mode ................................. 35
3.3.4. Close a TCP Client ......................................................................................................... 35
TCP Client Works in Direct Push Mode ..................................................................................... 35
3.4.1. Set up a TCP Client Connection and Enter into Direct Push Mode .............................. 35
3.4.2. Send Data in Direct Push Mode..................................................................................... 35
3.4.3. Receive Data from Remote Server in Direct Push Mode .............................................. 36
3.4.4. Close a TCP Client ......................................................................................................... 36
TCP Server Works in Buffer Access Mode ................................................................................ 36
3.5.1. Start a TCP Server ......................................................................................................... 36
3.5.2. Accept TCP Incoming Connection ................................................................................. 37
3.5.3. Receive Data from Incoming Connection ...................................................................... 37
3.5.4. Close a TCP Server ....................................................................................................... 37
Example of UDP Service ........................................................................................................... 37
3.6.1. Start a UDP Service ....................................................................................................... 37
3.6.2. Send UDP Data to Remote ............................................................................................ 38
3.6.3. Receive Data from Remote ............................................................................................ 38
3.6.4. Close a UDP Service ..................................................................................................... 38
PING........................................................................................................................................... 39
Synchronize Local Time ............................................................................................................. 39
Example of Getting Last Error Code .......................................................................................... 39

Summary of Error Codes .................................................................................................................. 40
Appendix A Reference....................................................................................................................... 42

BG96_TCP/IP_AT_Commands_Manual

4 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

Table Index
TABLE 1: SUMMARY OF ERROR CODES ...................................................................................................... 40
TABLE 2: TERMS AND ABBREVIATIONS ........................................................................................................ 42

BG96_TCP/IP_AT_Commands_Manual

5 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

1

Introduction

Quectel BG96 module features embedded TCP/IP stack, which enables the host to access the Internet
directly via AT commands. This greatly reduces the dependence on the PPP and TCP/IP protocol stacks
and thus minimizes the cost. BG96 module provides the following socket services: TCP client, UDP client,
TCP server and UDP server.

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.

BG96_TCP/IP_AT_Commands_Manual

6 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

Power on the module

Recommended Power on/off:
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,
and then pull it to high.

Send AT command and wait for the module to respond OK

Query (U)SIM Card Status:
Execute AT+CPIN. Reboot the module if
AT+CPIN? fails to identify (U)SIM card in
20s.

Identify (U)SIM card

CS Service:
1. If  of AT+CREG? equals to 1 or 5,
it means that the module has registered on
CS domain service.
2. Reboot the module if it fails to register on
CS domain service in 90s.

Register on CS domain service in 60s
Query PS service in 60s by
AT+CGREG?/
AT+CEREG?

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

Reboot the
module if
there is no
response in
40s.

If failed to register on CS
domain service in 90s,
then reboot the module.

Query CS service by
AT+CREG?

PS Service:
1. If  of AT+CGREG?/AT+CEREG?
equals to 1 or 5, it means that the module
has registered on PS domain service in
UMTS/LTE network.
2. Go to next step no matter whether it is
registered on PS domain service or not in
60s.

Activate a PDP Context:
1. Activate the PDP context by
AT+QIACT=.
2. Query IP address of the PDP
context by AT+QIACT?.
Notes:
a) All above commands should be
executed together in sequence.
b) Reboot the module if there is no
response for AT+QIACT in 150s.
c) If failed to deactivate the PDP
context for 3 times continuously,
then reboot the module.
3. Deactivate the PDP context:
reboot the module if there is no
response for AT+QIDEACT in 40s.

If failed to identify (U)SIM
card in 20s, then reboot the
module.

Query (U)SIM card
status by AT+CPIN?

Configure the PDP context and Qos by
AT+QICSGP/AT+CGQREQ/
AT+CGEQREQ/AT+CGQMIN/
AT+CGEQMIN

The PDP
context is
deactivated
successfully

Activate the PDP context by
AT+QIACT=
and AT+QIACT?

Failed to activate
the PDP context
Deactivate
the PDP context by
AT+QIDEACT=


Open Connection:
1. If failed to get response of AT+QIOPEN in 150s, then
close connection.
2. If failed to open connection for 5 times continuously,
deactivate the PDP context first, and then re-activate the
PDP context and open connection again.

1. Reboot the module if
there is no response in
150s.
2. If failed to deactivate the
PDP context for 3 times
continuously, then reboot
the module.

Successfully activate PDP context

Open connection
by AT+QIOPEN

1. Failed to open connection
continuously for 5 times.
2. There is no response in150s.

+QIOPEN: ,

Send data by
AT+QISEND=
Get ACK
in 90s

TCP Connection Maintenance and Detection:
1. Send data by AT+QISEND =[,].
It is recommended to periodically send a small data packet to the remote
end to maintian and detect the TCP connection.
2. Query sending ACK by AT+QISEND=,0.
If the package is still not acknowledged after two minutes (query every 5
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.

Query sending
ACK by AT+QISEND=
,0

Failed to get ACK in 90s
Close connection
by AT+QICLOSE=


OK
Reboot the module if there is
no response in 10s.

Notes:
1. Please note that you 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 AT+QIDEACT 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

BG96_TCP/IP_AT_Commands_Manual

7 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

1.2. Description of Data Access Modes
BG96 module supports 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 . 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
data from the Internet, it will buffer the data and report a URC as “+QIURC: “recv”,”.
Customers can read data via AT+QIRD command.

2.

In direct push mode, data can be sent via AT+QISEND command, and if the module has received
data from the Internet, the data will be outputted to COM port directly in the following format:
“+QIURC: “recv”,,”.

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. Customers can use “+++” 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 return back to transparent access mode.
4. 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)
2)
3)
4)

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

5. There are two methods to return back to the transparent access mode:
1)
2)

By AT+QISWTMD. Specify the  as 2 when executing this command. If entering
into transparent access mode successfully, “CONNECT” will be returned.
By ATO. ATO will change the access mode of connection that exits from transparent access mode
lately. If entering into transparent access mode successfully, “CONNECT” will be returned. If there
is no connection entering into transparent access mode before, ATO will return “NO CARRIER”.

BG96_TCP/IP_AT_Commands_Manual

8 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

NOTES
1.
2.

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 buffer.
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 socket service.

BG96_TCP/IP_AT_Commands_Manual

9 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

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 , ,  and other parameters of a
TCP/IP context.

AT+QICSGP Configure Parameters of a TCP/IP Context
Test Command
AT+QICSGP=?

Response
+QICSGP:
(1-16),(1,2),,,,(0-3)
OK

Write Command
Query the configuration of a context
AT+QICSGP=

Response
+QICSGP:
,,,,
OK

Write Command
Configure the context
AT+QICSGP=[,,[,,)[,]]]

Response
OK
ERROR

Parameter







Integer type. The context ID. The range is 1-16.
Integer type. The protocol type.
1 IPV4
2 IPV6*
String type. The access point name.
String type. The username.
String type. The password.

BG96_TCP/IP_AT_Commands_Manual

10 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual



Integer type. The authentication methods.
0
NONE
1
PAP
2
CHAP
3
PAP or CHAP

Example
AT+QICSGP=1
+QICSGP: 1,"","","",0

//Query the configuration of context 1.

OK
AT+QICSGP=1,1,"UNINET","","",1
OK

//Configure context 1. APN is “UNINET” for China Unicom.

NOTE
“*” means under development.

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?. The range of  is 1-16. According to
3GPP specifications, the module only supports three PDP contexts activated simultaneously, so
customers must make sure the number of activated PDP contexts is less than 3. 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
AT+QIACT=?

Response
+QIACT: (1-16)
OK

Read command
AT+QIACT?

BG96_TCP/IP_AT_Commands_Manual

Response
Return the list of the current activated contexts and their IP
addresses:
+QIACT:
1,,[,]
[.....
+QIACT:
16,,[,]]

11 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

OK
Write Command
AT+QIACT=

Response
Activate the specified context:
OK
Or
ERROR

Maximum Response Time

150 seconds, determined by network.

Parameter







Integer type. The context ID. The range is 1-16.
Integer type. The context state.
0
Deactivated
1
Activated
Integer type. The protocol type.
1
IPV4
2
IPV6*
The local IP address after the context is activated.

NOTE
“*” means under development.

2.1.3.

AT+QIDEACT

Deactivate a PDP Context

The command is used to deactivate the 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
AT+QIDEACT=?

Response
+QIDEACT: (1-16)
OK

Write Command
AT+QIDEACT=

BG96_TCP/IP_AT_Commands_Manual

Response
OK
Or
ERROR

12 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

Maximum Response Time

40 seconds, determined by network.

Parameter


2.1.4.

Integer type. The context ID. The range is 1-16.

AT+QIOPEN

Open a Socket Service

The command is used to open a socket service. The service type can be specified by 
parameter. The data access mode (buffer access mode, direct push mode and transparent access mode)
can be specified by  parameter. The “+QIOPEN” URC indicates whether the socket
service has been opened successfully.
1.

If  is “TCP LISTENER”, the module works as TCP SERVER. After accepting a new
TCP connection, the module will automatically specify a  and report a URC as “+QIURC:
“incoming”,,,,”. The range of  is 0-11.
The type of this new incoming connection is “TCP INCOMING” and the  of “TCP
INCOMING” is the same with the  of “TCP LISTENER”.

2.

If  is “UDP SERVICE”, UDP data can be sent to or received from the remote IP via
.
 Send data: execute AT+QISEND=,,,.
 Receive data in direct push mode: the module reports a URC as “+QIURC:
“recv”,,,,”.
 Receive data in buffer access mode: the module reports a URC as “+QIURC:
“recv”,”, and then customers can retrieve data via AT+QIRD=.

3.

It is suggested to wait for 150 seconds for “+QIOPEN: ,” to be outputted. If the
URC cannot be received in 150 seconds, AT+QICLOSE should be used to close the socket.

AT+QIOPEN

Open a Socket Service

Test Command
AT+QIOPEN=?

Response
+QIOPEN: (1-16),(0-11),"TCP/UDP/TCP LISTENER/UDP
SERVICE","/",,,(0-2)
OK

Write Command
AT+QIOPEN=,,,/,[, is transparent access mode and it is
successful to open the service, response:
CONNECT

13 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

rt>[,]]
If there is any error, response:
ERROR
Error description can be got via AT+QIGETERROR.
If the  is buffer access mode or direct push
mode, response:
OK
+QIOPEN: ,
 is 0 when service is opened successfully. In other cases,
 is not 0.
Maximum Response Time

150 seconds, determined by network.

Parameter














Integer type. The context ID. The range is 1-16.
Integer type. The socket service index. The range is 0-11.
String type. The socket service type.
“TCP”
Start a TCP connection as a client
“UDP”
Start a UDP connection as a client
“TCP LISTENER”
Start a TCP server to listen to TCP connection
“UDP SERVICE”
Start a UDP service
String type.
If  is TCP or UDP, it indicates the IP address of remote server, such as
“220.180.239.212”.
If  is TCP LISTENER or UDP SERVICE, please enter “127.0.0.1”.
String type. The domain name address of the remote server.
The port of the remote server, only valid when  is “TCP” or “UDP”.
The range is 0-65535.
The local port. The range is 0-65535.
If  is “TCP LISTENER” or “UDP SERVICE”, this parameter must be
specified.
If  is “TCP” or “UDP”, if  is 0, then the local port will be
assigned automatically. Otherwise the local port is assigned as specified.
Integer type. The data access mode of the socket service.
0
Buffer access mode
1
Direct push mode
2
Transparent access mode
Integer type. The error code of the operation. Please refer to Chapter 4.

BG96_TCP/IP_AT_Commands_Manual

14 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

2.1.5.

AT+QICLOSE

Close a Socket Service

The command is used to close the specified socket service. Depending on the network, it will take at most
10 seconds (default value, can be modified by ) 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
AT+QICLOSE=?

Response
+QICLOSE: (0-11),(0-65535)
OK

Write Command
AT+QICLOSE=[,]

Response
If successfully closed, response:
OK
If failed to close, response:
ERROR

Parameter



2.1.6.

Integer type. The socket service index. The range is 0-11.
Integer type. If the FIN ACK of the other peers is not received within , the
module will force to close the socket. The range is 1-65535, and the default value is 10.
Unit: second.

AT+QISTATE

Query Socket Service Status

The command is used to query the socket service status. If the  is 0, it will return the status
of all existing socket services in the specified context. If the  is 1, it will return the status of
the specified socket service.

AT+QISTATE

Query Socket Service Status

Test Command
AT+QISTATE=?

Response
OK

Read/Execution Command
AT+QISTATE? or AT+QISTATE

Response
Return the status of all existing connections:
List of (+QISTATE:
,,,
,,,,,,)
OK

BG96_TCP/IP_AT_Commands_Manual

15 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

Write Command
If  is 0, query connection
status of the specified context
AT+QISTATE=,

Response
Return the status of all existing connections in specified
context:
List of (+QISTATE:
,,,
,,,,,,)
OK

Write Command
If  is 1, query connection
status of the specified socket service
AT+QISTATE=,

Response
+QISTATE:
,,,
,,,,,,
OK

Parameter


Integer type. The query type.
0 Query connection status of the specified context
1 Query connection status of the specified socket service

Integer type. The context ID. The range is 1-16.

Integer type. The socket service index. The range is 0-11.
 String type. The socket service type.
“TCP”
Start a TCP connection as a client
“UDP”
Start a UDP connection as a client
“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
 IP address.
If =“TCP” or “UDP”, it is the IP address of remote server.
If =“TCP LISTENER” or “UDP SERVICE”, it is the local IP address.
If =“TCP INCOMING”, it is the IP address of remote client.
 Remote port number.
If =“TCP” or “UDP”, it is the port of remote server.
If =“TCP LISTENER” or “UDP SERVICE”, the port is invalid.
If =“TCP INCOMING”, it is the port of remote client.

Local port number.
If  is 0, then the local port is assigned automatically.
 Integer type. The socket service status.
0
“Initial”: connection has not been established
1
“Opening”: client is connecting or server is trying to listen

BG96_TCP/IP_AT_Commands_Manual

16 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

2
“Connected”: client/incoming connection has been established
3
“Listening”: server is listening
4
“Closing”: connection is closing

Only valid when  is “TCP INCOMING”.  represents which
server accepts this TCP incoming connection, and the value is the same as
 of this server’s “TCP LISTENER”.
 Data access mode.
0
Buffer access mode
1
Direct push mode
2
Transparent access mode

String type. COM port of socket service.
“usbmodem”
USB MODEM PORT
“usbat”
USB AT PORT
“uart1”
UART PORT1

2.1.7.

AT+QISEND Send Data

If  of the specified socket service is buffer access mode or direct push mode, data can be
sent via AT+QISEND. If 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
customers can try to resend the data. “ERROR” indicates it encounters an error in the process of sending
data. Customers should delay some time for the data 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=, 0 command.

AT+QISEND Send Data
Test Command
AT+QISEND=?

Response
+QISEND: (0-11),(0-1460)
OK

Write Command
If  is “TCP”, “UDP” or
“TCP INCOMING”, send data with
changeable length
AT+QISEND=
After response “>”, input the data to be
sent. Tap CTRL+Z to send, and tap ESC
to cancel the operation

Response
>

CTRL+Z
If connection has been established and sending is successful,
response:
SEND OK
If connection has been established but sending buffer is full,
response:
SEND FAIL

BG96_TCP/IP_AT_Commands_Manual

17 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

If connection has not been established, abnormally closed, or
the parameter is incorrect, response:
ERROR
Write Command
If  is “TCP”, “UDP” or
“TCP INCOMING”, send data with fixed
length
AT+QISEND=,
After response “>”, input data until the
data length is equal to 

Response
>

If connection has been established and sending is successful,
response:
SEND OK
If connection has been established but sending buffer is full,
response:
SEND FAIL
If connection has not been established, abnormally closed, or
the parameter is incorrect, response:
ERROR

Write Command
If  is “UDP SERVICE”
AT+QISEND=,,,
After response “>”, type data until the
data length is equal to 

Response
This command is used to send fixed length data to specified
remote IP address and remote port. The  must
be “UDP SERVICE”.
>

If connection has been established and sending is successful,
response:
SEND OK
If connection has been established but sending buffer is full,
response:
SEND FAIL
If connection has not been established, abnormally closed, or
parameter is incorrect, response:
ERROR

Write Command
When  is 0, query the
sent data
AT+QISEND=,0

Response
If the specified  connection has existed, response:
+QISEND:
,,
OK
If there is any error, response:

BG96_TCP/IP_AT_Commands_Manual

18 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

ERROR

Parameter




Integer type. Socket service index. The range is 0-11.
Integer type. The length of data to be sent, which cannot exceed 1460 bytes.
String type. The remote IP address (must be dot format), only valid when
 is “UDP SERVICE”.

Integer type. The remote port, only valid when  is “UDP SERVICE”.
 Integer type. The total length of sent data. Unit: byte.

Integer type. The total length of acknowledged data. Unit: byte.

Integer type. The total length of unacknowledged data. Unit: byte.

Integer type. The error code of the operation. Please refer to Chapter 4.

2.1.8.

AT+QIRD

Retrieve the Received TCP/IP Data

In buffer access mode, after receiving data, the module will buffer it and report “+QIURC:
“recv”,”, then data can be retrieved 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 retrieved via AT+QIRD from buffer.

AT+QIRD Retrieve the Received TCP/IP Data
Test Command
AT+QIRD=?

Response
+QIRD: (0-11),(0-1500)
OK

Write Command
When  is
“TCP”/“UDP”/“TCP INCOMING”
AT+QIRD=[,]

Response
If the specified connection has received data, response:
+QIRD: 
OK
If there is no data, response:
+QIRD: 0
OK
If connection does not exist, response:
ERROR

Write Command
When  is

BG96_TCP/IP_AT_Commands_Manual

Response
If data exists, response:

19 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

“UDP SERVICE”
AT+QIRD=

+QIRD:
,,
OK
If there is no data, response:
+QIRD: 0
OK
If connection does not exist, response:
ERROR

Write Command
When  is 0, query the
retrieved data
AT+QIRD=,0

Response
If the specified connection has existed, response:
+QIRD:
,,
OK
If there is any error, response:
ERROR

Parameter










Integer type. The socket service index. The range is 0-11.
The maximum length of data to be retrieved. The range is 0-1500. Unit: byte.
The actual length of received data. Unit: byte.
String type. The remote IP address, only valid when  is “UDP
SERVICE”.
Integer type. The remote port, only valid when  is “UDP
SERVICE”.
The retrieved data.
The total length of received data. Unit: byte.
The length of read data. Unit: byte.
The length of unread data. Unit: byte.

BG96_TCP/IP_AT_Commands_Manual

20 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

2.1.9.

AT+QISENDEX

Send Hex String

This command cannot be applied for “UDP SERVICE” and “TCP LISTENER” sockets.

AT+QISENDEX

Send Hex String

Test Command
AT+QISENDEX=?

Response
+QISENDEX: (0-11),
OK

Write Command
AT+QISENDEX=,

Response
If sent successfully, response:
SEND OK
If there is no data, response:
SEND FAIL
If connection does not exist, response:
ERROR

Parameter



Integer type. The socket service index. The range is 0-11.
String type. Hex string. The max length is 512 bytes.

2.1.10. AT+QISWTMD Switch Data Access Modes
The command can be used to switch the data access modes: buffer access mode, direct push mode and
transparent access mode. When starting a socket service, data access modes can be specified via the
 parameter of AT+QIOPEN. After a socket has been opened, the data access modes can
be changed via AT+QISWTMD.

AT+QISWTMD Switch Data Access Modes
Test Command
AT+QISWTMD=?

Response
+QISWTMD: (0-11),(0-2)
OK

Write Command
AT+QISWTMD=,

BG96_TCP/IP_AT_Commands_Manual

Response
If data access mode is switched
 is 0 or 1, response:
OK

successfully

and

21 / 42

LTE Module Series
BG96 TCP/IP AT Commands Manual

If data access mode is switched successfully and
 is 2, the module will enter into data mode,
response:
CONNECT
If there is any error, response:
ERROR

Parameter



2.1.11. AT+QPING

Integer type. The socket service index. The range is 0-11.
Integer type. The data access modes of the connection.
0
Buffer access mode
1
Direct push mode
2
Transparent access mode

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  via AT+QIACT first. It will return the result
during  and the default value of  is 4 seconds.

AT+QPING

Ping a Remote Server

Test Command
AT+QPING=?

Response
+QPING: (1-16),,(1-255),(1-10)
OK

Write Command
AT+QPING=,[,[,]]

Response
If ping a remote server successfully, response:
OK
[+QPING:
[,,,

Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : No
Encryption                      : Standard V4.4 (128-bit)
User Access                     : Print, Copy, Extract, Print high-res
Author                          : Amy.Feng
Create Date                     : 2017:11:23 13:05:21+08:00
Modify Date                     : 2017:11:23 13:07:55+08:00
Language                        : zh-CN
XMP Toolkit                     : Adobe XMP Core 4.2.1-c041 52.342996, 2008/05/07-20:48:00
Format                          : application/pdf
Creator                         : Amy.Feng
Creator Tool                    : Microsoft® Word 2010
Metadata Date                   : 2017:11:23 13:07:55+08:00
Producer                        : Microsoft® Word 2010
Document ID                     : uuid:1c618a70-d1d5-4d6a-b217-e6d9a8e88841
Instance ID                     : uuid:581cff3c-000a-44e6-bea8-8fc0fdd7d25d
Page Mode                       : UseOutlines
Page Count                      : 43
EXIF Metadata provided by EXIF.tools

Navigation menu