LPWA Module Series
BG96 TCP/IP Application Note
BG96_TCP/IP_Application_Note 14 / 52
Parameter
2.2.4. AT+QIOPEN Open a Socket Service
The Write Command opens a socket service. The service type can be specified by <service_type>. The
data access mode (buffer access mode, direct push mode and transparent access mode) can be
specified by <access_mode>. URC +QIOPEN indicates whether the socket service has been opened
successfully.
1. If <service_type> is "TCP LISTENER", the module works as a TCP server. After accepting a new
TCP connection, the module will automatically specify a <connectID> and report URC +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 as same as the <access_mode> 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 URC +QIURC: "recv",<connectI
D>,<currentrecvlength>,<remoteIP>,<remote_port><CR><LF><data>.
Receive data in buffer access mode: the module reports URC +QIURC: "recv",<connectID>,
and then the 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, AT+QICLOSE should be used to close the socket.
<contextID> Integer type. Context ID. Range: 1–16.
AT+QIOPEN Open a Socket Service
Response
+QIOPEN: (range of supported <contextID>s),(range of
supported <connectID>s),"TCP/UDP/TCP LISTENER/UDP
SERVICE",<IP_address>/<domain_name>,(range of
supported <remote_port>s),(range of supported
<local_port>s),(range of supported <access_mode>s)
OK
Write Command
AT+QIOPEN=<contextID>,<connectID
>,<service_type>,<IP_address>/<dom
ain_name>,<remote_port>[,<local_po
rt>[,<access_mode>]]
Response
If <access_mode>=2 and the socket service is opened
successfully:
CONNECT