background image

                                                                                                     

LPWA  Module  Series 

                                                                                BG95&BG77&BG600L  Series  TCP/IP  Application  Note 

BG95&BG77&BG600L_Series_TCP/IP_Application_Note                                                                  49 / 56 

 
 

 

 

3.9.2.  Send UDP Data to Remote Client 

 

3.9.3.  Receive Data from Remote Client 

 

3.10. UDP Client with RAI Feature 

3.10.1.  Start a UDP Client 

 

+QIOPEN: 2,0

                                                                         

//UDP service is opened successfully. 

AT+QISTATE=0,1   

                                                             

//Query the connection status of context 1. 

+QISTATE: 2,"UDP SERVICE","2001:468:2100:1:2001:468:2100:1",0,12345,2,1,2,0,"usbmodem" 

 

OK

 

 

AT+QISEND=2,10,"2001:468:2100:1:0:0:0:0",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.  One  whole  UDP  packet  will  be 

outputted. There is no need to specify the read length.   

+QIRD: 4,"2001:468:2100:1:0:0:0:0",5001

      //The retrieved data length is 4 bytes. The IP address of 

the remote client is 2001:468:2100:1:0:0:0:0 and the port 

is 5001.   

AAAA 

 

OK 

AT+QIRD=2 

 

                                                          //Retrieve data. 

+QIRD: 0

                                                                  //No data in buffer. 

 

OK 

//Start a UDP client whose 

<connectID>

 is 0 and 

<context>

 is 1. Before using 

AT+QIOPEN

, the host 

should activate the context with 

AT+QIACT

 first.

 

AT+QIOPEN=1,0,"UDP","220.180.239.212",8009   

 

OK 

Summary of Contents for BG95 Series

Page 1: ...BG95 BG77 BG600L Series TCP IP Application Note LPWA Module Series Version 1 1 Date 2021 03 29 Status Released...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reviews: