background image

                                                                                                     

LPWA  Module  Series 

                                                                                BG95&BG77&BG600L  Series  TCP/IP  Application  Note 

BG95&BG77&BG600L_Series_TCP/IP_Application_Note                                                                  41 / 56 

 
 

 

 

3.2.4.  Close a Connection 

 

3.3. TCP Client Works in Buffer Access Mode under IPv6   

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

 

3.3.2.  Send Data in Buffer Access Mode 

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: 5,5,0 

 

OK 

AT+QICLOSE=0

 

                         

//Close  a  connection  whose 

<connectID>

  is  0.  Depending  on  the 

network, the maximum response time is 10s. 

OK

 

//Context  is  1  and 

<connectID>

  is  0.  Before  using

  AT+QIOPEN

,  the  host  should  activate  the  context 

with 

AT+QIACT

 first.

 

AT+QIOPEN=1,0,"TCP","2001:468:2100:1:0:0:0:0",5001,0,0

         

OK 

 

+QIOPEN: 0,0

                //TCP client is connected successfully. It is suggested to wait for 150 seconds for 

the URC 

+QIOPEN: <connectID>,<result>

. If the URC cannot be received in 

150 seconds, the host can use

 AT+QICLOSE

 to close the socket. 

AT+QISTATE=1,0 

       

//Query the connection status of socket service

 

1. 

+QISTATE: 0,"TCP","2001:468:2100:1:0:0:0:0",5001,11921,2,1,0,0,"usbmodem" 

 

OK 

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       

Содержание BG600L Series

Страница 1: ...BG95 BG77 BG600L Series TCP IP Application Note LPWA Module Series Version 1 1 Date 2021 03 29 Status Released...

Страница 2: ...to change without prior notice Disclaimer While Quectel has made efforts to ensure that the functions and features under development are free from errors it is possible that these functions and featur...

Страница 3: ...hnical information of Quectel Transmitting reproducing disseminating and editing this document as well as using the content without permission are forbidden Offenders will be held liable for payment o...

Страница 4: ...odule BG600L M3 2 Updated the valid value range of timeout in AT QICLOSE from 1 65535 to 0 65535 Chapter 2 3 5 3 Added RAI_info for AT QISENDEX to configure RAI Chapter 2 3 9 4 Changed the default val...

Страница 5: ...tus 20 2 3 7 AT QISEND Send Data 22 2 3 8 AT QIRD Retrieve the Received TCP IP Data 24 2 3 9 AT QISENDEX Send Hex String Data 25 2 3 10 AT QISWTMD Switch Data Access Mode 26 2 3 11 AT QPING Ping a Rem...

Страница 6: ...5 TCP Client Works in Direct Push Mode 43 3 5 1 Set up a TCP Client Connection and Enter Direct Push Mode 43 3 5 2 Send Data in Direct Push Mode 44 3 5 3 Retrieve Data from Remote Server in Direct Pus...

Страница 7: ...TCP IP Application Note BG95 BG77 BG600L_Series_TCP IP_Application_Note 6 56 3 10 3 Close a UDP Client 50 3 11 PING 51 3 12 Synchronize Local Time 51 3 13 Getting the Last Error Code 52 4 Summary of...

Страница 8: ...P IP Application Note BG95 BG77 BG600L_Series_TCP IP_Application_Note 7 56 Table Index Table 1 Applicable Modules 8 Table 2 Types of AT Commands 13 Table 3 Summary of Result Codes 53 Table 4 Related D...

Страница 9: ...protocol stacks and thus minimizes the cost BG95 series BG77 and BG600L M3 modules provide the following socket services TCP client UDP client TCP server UDP server 1 1 Applicable Modules Table 1 Appl...

Страница 10: ...s of corresponding module models to check whether the function has been supported 1 2 Usage of TCP IP AT Commands Through TCP IP AT commands the host can configure a PDP context activate deactivate th...

Страница 11: ...nd you entered before you enter the next AT command You can reboot the module if the module fails to get response in 60 s 2 Reboot the module if the module has not got response of AT QIACT in 150 s or...

Страница 12: ...n transparent transmission mode the corresponding COM port such as UART port USB modem port etc enters exclusive mode where data received from the port is sent to the Internet directly and data receiv...

Страница 13: ...ansmission mode before ATO returns NO CARRIER 1 In buffer access mode if the buffer is not empty the module does not report a new URC until all the received data has been read with AT QIRD from the bu...

Страница 14: ...Command Syntax All command lines must start with AT or at and end with CR Information responses and result codes always start and end with a carriage return character and a line feed character CR LF r...

Страница 15: ...AT Commands 2 3 1 AT QICSGP Configure Parameters of a TCP IP Context This command configures the APN username password and other parameters of a TCP IP context AT QICSGP Configure Parameters of a TCP...

Страница 16: ...n 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 contextID Integer type Context ID Rang...

Страница 17: ...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 OK Write Command Activate a specified PDP...

Страница 18: ...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 re...

Страница 19: ...hen the service is opened successfully In other cases result is not 0 Maximum Response Time 150 seconds determined by the network Characteristics contextID Integer type Context ID Range 1 16 connectID...

Страница 20: ...STENER or UDP SERVICE specify this parameter as 0 local_port Integer type Local port number Range 0 65535 If service_type is TCP LISTENER or UDP SERVICE this parameter must be specified Range 1 65535...

Страница 21: ...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 QISTATE connectID service_type IP_addre...

Страница 22: ...P INCOMING it is the IP address of a remote client remote_port Integer type Remote port number If service_type is TCP or UDP it is the port of a remote server If service_type is TCP LISTENER or UDP SE...

Страница 23: ...nd Data Test Command AT QISEND Response QISEND range of supported connectID s range of supported send_length s OK Write Command Send variable length data when service_type is TCP UDP or TCP INCOMING A...

Страница 24: ...the connection is established but the sending buffer is full SEND FAIL If the connection is not established abnormally closed or any parameter is incorrect ERROR Write Command When send_length is 0 qu...

Страница 25: ...ength of sent data Unit byte ackedbytes Integer type Total length of acknowledged data Unit byte unackedbytes Integer type Total length of unacknowledged data Unit byte AT QIRD Retrieve the Received T...

Страница 26: ...ice index Range 0 11 read_length Integer type Maximum length of the data to be retrieved Range 0 1500 Default value 1500 Unit byte read_actual_length Integer type Length of the data that has been actu...

Страница 27: ...ransparent transmission mode When starting a socket service the data access mode can be specified via the access_mode of AT QIOPEN After a socket has been opened the data access mode can be changed wi...

Страница 28: ...of supported access_mode s OK Write Command AT QISWTMD connectID access _mode Response If access_mode is 0 or 1 and data access mode is switched successfully OK If access_mode is 2 and data access mod...

Страница 29: ...10 Default value 4 ping_result Integer type Result of each ping request 0 Received the ping response from the host In this case it is followed by IP_address bytes time TTL Others See Chapter 4 for spe...

Страница 30: ...TP Server Test command AT QNTP Response QNTP range of supported contextID s server range of supported port s list of supported auto_set_time s OK Read command AT QNTP Response If in the process of loc...

Страница 31: ...TP server The format is YYYY MM DD hh mm ss zz Range of zz 48 to 56 AT QIDNSCFG Configure Address of DNS Server Test command AT QIDNSCFG Response QIDNSCFG range of supported contextID s pridnsadd r se...

Страница 32: ...ontext ID Range 1 16 host_name String type Domain name result Integer type Result code of the operation See Chapter 4 for details IP_count Integer type Number of the IP addresses corresponding to the...

Страница 33: ...CFG transwaittm tran swaittm Response If the optional parameter is omitted query the current setting QICFG transwaittm transwaittm OK If the optional parameter is specified set the waiting time for tr...

Страница 34: ...d query the current setting QICFG sack SACK OK If the optional parameter is specified configure whether to enable SACK option in TCP header OK Or ERROR Write Command Query set whether to enable TCP ke...

Страница 35: ...data to be sent 0 Text mode 1 Hex mode recv_data_format Integer type Format of the data to be received 0 Text mode 1 Hex mode view_mode Integer type Output format of received data 0 Output format of...

Страница 36: ...ting TCP IP commands the details of an error can be queried with AT QIGETERROR Please note that AT QIGETERROR just returns error code of the last TCP IP AT command max_rto Integer type Maximum interva...

Страница 37: ...ote peer or due to a network error the URC is outputted and the status of socket service is closing socket_state 4 AT QICLOSE connectID can be used to change the socket_state to initial Parameter AT Q...

Страница 38: ...tion request 2 4 4 QIURC incoming Indicate Incoming Connection If service_type is TCP LISTENER when a remote client connects to this server the host automatically assigns a free connectID to the new c...

Страница 39: ...Indicate Incoming Connection QIURC incoming connectID s erverID remoteIP remote_port When the new incoming connection is accepted by serverID the allocated connectID remoteIP and remote_port are infor...

Страница 40: ...1 Configure context 1 APN is CMNBIOT for China Mobile NB IoT network OK AT QIACT 1 Activate context 1 Depending on the network the maximum response time is 150 s OK Activated the context successfully...

Страница 41: ...t1 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 with AT QISEND 0 0 AT QISEND 0 4 Send fixed length...

Страница 42: ...is 0 Depending on the network the maximum response time is 10s OK Context is 1 and connectID is 0 Before using AT QIOPEN the host should activate the context with AT QIACT first AT QIOPEN 1 0 TCP 200...

Страница 43: ...data has been sent and the 9 byte data has been acknowledged by the server OK AT QISENDEX 0 3132333435 Send Hex string data SEND OK AT QISEND 0 0 Query the length of sent data acknowledged data and u...

Страница 44: ...uld activate the context with AT QIACT first AT QIOPEN 1 0 TCP 220 180 239 212 8009 0 2 CONNECT TCP client connected successfully It is suggested to wait for 150 seconds for the URC CONNECT If the URC...

Страница 45: ...QISTATE 0 TCP 220 180 239 212 8009 65344 2 1 0 1 usbmodem OK 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 hos...

Страница 46: ...0 0 1 0 2020 0 OK QIOPEN 1 0 TCP server is opened successfully AT QISTATE 0 1 Query the connection status of context 1 QISTATE 1 TCP LISTENER 10 7 157 1 0 2020 3 1 1 0 usbmodem OK QIURC incoming 11 1...

Страница 47: ...ctID is 1 Before using AT QIOPEN the host should activate the context with AT QIACT first AT QIOPEN 1 1 TCP LISTENER 0 0 0 0 0 0 0 1 0 12345 0 OK QIOPEN 1 0 TCP server is opened successfully AT QISTAT...

Страница 48: ...rvice index is 11 to transparent transmission mode CONNECT 1234567890 Send data directly Exit from transparent transmission mode OK AT QICLOSE 11 Close the incoming connection Depending on the network...

Страница 49: ...7 76 34 and the port is 7687 AAAA OK AT QIRD 2 Retrieve data QIRD 0 No data in buffer OK AT QISEND 2 10 10 7 76 34 7687 Send data to the remote client whose IP is 10 7 76 34 and the port is 7687 12345...

Страница 50: ...5001 Send 10 bytes data to a remote client whose IP is 2001 468 2100 1 0 0 0 0 and the port is 5001 1234567890 SEND OK QIURC recv 2 Received data from the remote client AT QIRD 2 Retrieve UDP data On...

Страница 51: ...ON 1 0 After 20 s RRC connection released AT QISENDEX 0 313233 1 Send 123 and release RRC connection right now SEND OK 18 51 59 905 QCSCON 1 1 RRC connection setup successfully 18 52 01 135 QCSCON 1 0...

Страница 52: ...479 255 QPING 0 4 4 0 192 479 287 AT QPING 1 2001 468 2100 1 0 0 0 0 Ping 2001 468 2100 1 0 0 0 0 in context 1 Before pinging the destination IP address the host should activate the context with AT Q...

Страница 53: ...cation Note BG95 BG77 BG600L_Series_TCP IP_Application_Note 52 56 3 13 Getting the Last Error Code OK AT QIOPEN 1 TCP 220 180 239 212 8009 0 1 Start a socket service but and connectID is not present E...

Страница 54: ...eturns error code of the last TCP IP AT command Table 3 Summary of Result Codes result result_code_description 0 Operation successful 550 Unknown error 551 Operation blocked 552 Invalid parameters 553...

Страница 55: ...BG77 BG600L_Series_TCP IP_Application_Note 54 56 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 Can...

Страница 56: ...AT command manual of BG95 series BG77 and BG600L M3 modules Abbreviation Description 3GPP 3rd Generation Partnership Project ACK Acknowledge APN Access Point Name CHAP Challenge Handshake Authenticat...

Страница 57: ...Series_TCP IP_Application_Note 56 56 QoS Quality of Service SACK Selective Acknowledgment TCP Transmission Control Protocol UART Universal Asynchronous Receiver Transmitter UDP User Datagram Protocol...

Отзывы: