- Support portal
- Evaluation Kits and partner products
u-blox Support
- Product documentation
Documentation
- About
- Sustainability
- Partners and Alliances
- Contact
About u-blox
- Investor relations
Investor relations
TCP and UDP sockets are independently and simultaneously managed via dedicated AT commands over the same EPS bearer/PDP context. AT commands for both reading and writing data on sockets are provided, and incoming data and transmission result are notified to the external application via URCs, therefore polling is not needed.
When socket commands report an error result code which is not a +CME ERROR, the error result code can be queried using the +USOER or +USOCTL (specifying the socket ID and with <param_id>=1) AT commands.
If not specified, the <cid> and the <preferred_protocol_type> parameters set by the +UDCONF=19 AT command are used. In LTE there is no need to establish a packet data connection explicitly, as the device automatically establishes it as part of the network registration procedure. See +CGACT AT command for activating a PDP context on a <cid> different from 1 and in 2G and 3G RAT.
The <preferred_protocol_type> parameter specifies the requested protocol type: if an IP address of the requested type is not available, there will be no connection attempt.
The UDP protocol has no flow control mechanism and uplink packets might be lost in the following scenarios:
No network signal is available
Unreliable radio interface (e.g. mobility with radio link failures, which can lead to data loss, that in GPRS can be contrasted with the usage of LLC ack reliability QoS parameter)
Some network operators close dynamic NATs after few minutes if there is no activity on the connection (no data transfer in the period). To solve this problem enable the TCP keep alive option with 1 minute delay (see the +USOSO AT command).
When both TCP and UDP sockets are used at the same time at the maximum throughput (downlink and uplink at the maximum allowed baud rate) it is possible to lose some incoming UDP packets due to internal buffer limitation. A possible workaround is provided as follows:
If it is possible, adopt an application layer UDP acknowledge system
The <socket> parameter sets the socket identifier to be used for any future operation on that socket. <socket> range lists the allowed range:
Product | Maximum number of sockets | Allowed range |
---|---|---|
LEXI-R10 | 7[2] | 0-6 |
<socket> range
The section describes the IP addressing formats and IP address rules used by TCP/IP UDP/IP enabled applications.
Format:
32 bits long in dot-decimal notation (without leading 0 notation).
All the decimal numbers must be in range 0-255.
The dot-octal notation is not supported.
The dot-hexadecimal notation is not supported.
Examples:
IPv4 address | Remarks |
---|---|
254.254.254.254 | Valid address |
010.228.76.34 | Invalid address; first decimal number prefixed with a leading zero |
257.228.76.34 | Invalid address; first decimal number greater than 255 |
0010.0344.0114.0042 | Invalid address; dot-octal notation; decimals given as octal numbers |
0x10.0xE4.0x4C.0x22 | Invalid address; dot-hexadecimal notation; decimals given as hexadecimal numbers |
IPv4 address format examples
Format:
128 bits long represented in 8 groups of 16 bits each.
The 16 bits of a group are represented as 2 concatenated hexadecimal numbers.
The groups are separated by a colon character (:).
The leading 0 in a group is supported.
A group containing 4 zeros can be abbreviated with one 0.
Continuous groups (at least 2) with zeroes can be replaced with a double colon (::).
The double colon can appear only once in an IPv6 address.
Examples:
IPv6 address | Remarks |
---|---|
2001:0104:0000:0000:0000:0104:0000:0000 | Full version, with leading zeros |
2001:104:0000:0000:0000:104:0000:0000 | Abbreviated version, leading zero abbreviation |
2001:104:0:0:0:104:0:0 | Abbreviated version, zero group abbreviation |
2001:104::104:0:0 | Abbreviated version, one double colon abbreviation |
IPv6 address format examples
The following AT commands support the IPv6 address format:
Dynamic DNS update: +UDYNDNS
Connect Socket: +USOCO
SendTo command: +USOST
Receive From command: +USORF
Set Listening Socket: +USOLI
IP Change Notification: +UIPCHGN
FTP service configuration: +UFTP
HTTP control: +UHTTP
For packet switched services AT commands (i.e. PDP_addr in +CGDCONT) the format is specified in the corresponding command section.
The section describes the Socket Always On feature and how it affects the module’s operations in power saving.
When power saving is enabled on the module (see +UPSV AT command), socket creation and socket operations can affect the entrance into deep-sleep modes depending on the socket’s Always On (AoN) attribute.
In particular, the creation of a socket not configured as AoN prevents the module from entering Hibernate and Sleep-2 deep-sleep modes, allowing only to enter Sleep-1 deep-sleep mode. The status of a socket configured as AoN is instead maintained when the module enters deep-sleep modes and its creation imposes no constraints on the achievable deepest level of power saving.
Listed below are other conditions that prevent or limit the setting of a socket as AoN:
Only one TCP socket and one UDP socket can be set as AoN.
A socket is automatically set as AoN if there are no other AoN sockets of the same protocol type (TCP or UDP) already open.
An AoN TCP socket set in listening mode (+USOLI AT command) automatically becomes not AoN.
An AoN socket configured as secure (+USOSEC AT command) automatically becomes not AoN.
A secure socket configured as not secure (+USOSEC AT command) can become AoN if no other sockets AoN of the same protocol (TCP or UDP) are already open.
The following operations prevent the module from entering Hibernate or Sleep-2 modes even when applied to sockets set as AoN:
The execution of any socket’s command that requires sending/receiving data to/from the remote peer (e.g. +USOCO AT command) until the result is returned on the AT interface.
Setting any socket in direct link state (+USODL AT command).
The execution of a socket command in binary mode (+USOWR or +USOST AT commands).
The execution of an asynchronous command until the procedure is completed and the corresponding URC is issued on the AT interface.
If there is data in the RX buffer, until all bytes have been read.
+USOCR | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
partial | No | No | No | - |
Creates a socket and associates it with the specified protocol (TCP or UDP), returns a number identifying the socket. Such command corresponds to the BSD socket routine; for the maximum number of sockets that can be created, see the <socket> parameter description. It is possible to specify the local port to bind within the socket in order to send data from a specific port. The bind functionality is supported for both TCP and UDP sockets. When the PDP context is IPv4v6, it is possible to set the preferred address type (IPv4 or IPv6) using the <preferred_protocol_type> parameter. A socket can select the PDP context to be used via the <cid> parameter; if <cid> is not supported or not specified, created sockets are mapped to the default CID. Where supported, the read command reports the open sockets.
The socket creation can be performed only after the PDP context activation of the default or specified CID.
The Socket Always On feature is supported. For more details, see Sockets Always On.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USOCR=<protocol>[,<local_port>[,<preferred_protocol_type>[,<cid>[,<report_AoN>]]]] | +USOCR: <socket>[,<AoN_state>] OK | AT+USOCR=17 +USOCR: 2 OK |
Read | AT+USOCR? | +USOCR: <socket>,<protocol>,<AoN_state> [[…] +USOCR: <socket>,<protocol>,<AoN_state>] OK | +USOCR: 0,6,1 +USOCR: 1,6,0 +USOCR: 2,17,1 +USOCR: 3,17,0 OK |
Test | AT+USOCR=? | +USOCR: (list of supported <protocol>s),(list of supported <local_port>s),(list of supported <preferred_protocol_type>s)[,(list of supported <cid>s)[,(list of supported <report_AoN>s)]] OK | +USOCR: (6,17),(1-65535),(0,1),(1-24) OK |
Parameter | Type | Description |
---|---|---|
<protocol> | Number | Allowed values:
|
<local_port> | Number | Local port to be used while sending data. The range goes from 1 to 65535. If the parameter is omitted it will be set to 0; in this case a random port will be used while sending data. |
<socket> | Number | See <socket>. |
<preferred_protocol_type> | Number | Selects the specific IP type (for the required <socket>) between IPv4 and IPv6 when <PDP_type> is set to "IPV4V6" while the PDP context is created by means of +CGDCONT AT command. Allowed values:
For more details on the default value of the parameter (where supported), see Internet protocol transport layer. |
<cid> | Number | Specifies the PDP context that will be used for the socket operations. For the parameter range, see <cid>. For more details on the default value of the parameter (where supported), see Internet protocol transport layer. |
<report_AoN> | Number | Specifies if the set command response shall report if the created socket is configured as Always On (AoN).
|
<AoN_state> | Number | Specifies if the socket is configured as Always On (AoN).
|
+USOSEC | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No |
Enables or disables the use of SSL/TLS/DTLS connection (where supported) on a TCP/UDP socket. The configuration of the SSL/TLS/DTLS properties is provided with an SSL/TLS/DTLS profile managed by USECMNG.
The <usecprf_profile_id> parameter is listed in the information text response to the read command only if the SSL/TLS/DTLS is enabled on the interested socket.
The enable or disable operation can be performed only after the socket has been created with +USOCR AT command.
The SSL/TLS/DTLS is supported only with +USOCO command (socket connect command). The SSL/TLS/DTLS is not supported with +USOLI command (socket set listen command is not supported and the +USOSEC settings will be ignored).
The command response time may vary depending on the module series. For more details, see the Estimated maximum command response time.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USOSEC=<socket>,<ssl_tls_dtls_status>[,<usecprf_profile_id>] | OK | AT+USOSEC=0,1,1 OK |
Read | AT+USOSEC=<socket> | +USOSEC: <socket>,<ssl_tls_dtls_status>[,<usecprf_profile_id>] OK | AT+USOSEC=0 +USOSEC: 0,1,1 OK |
Test | AT+USOSEC=? | +USOSEC: (list of supported <socket>s),(list of supported <ssl_tls_dtls_status>s),(list of supported <usecprf_profile_id>s) OK | +USOSEC: (0-6),(0,1),(0-4) OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<ssl_tls_dtls_status> | Number |
|
<usecprf_profile_id> | Number | Defines the USECMNG profile which specifies the SSL/TLS/DTLS properties to be used for the SSL/TLS/DTLS connection. The range goes from 0 to 4. If no profile is set a default USECMNG profile is used (see USECMNG section). |
+USOSO | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Sets the specified standard option (type of service, local address re-use, linger time, time-to-live, etc.) for the specified socket, like the BSD setsockopt routine.
Issue a set command to set each parameter.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USOSO=<socket>,<level>,<opt_name>,<opt_val>[,<opt_val2>] | OK | AT+USOSO=2,6,1,1 OK |
Test | AT+USOSO=? | +USOSO: (list of supported <socket>s),(list of supported <level>s) OK | +USOSO: (0-6),(0,6,65535) OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<level> | Number | Allowed values:
|
<opt_name> | Number | Type and supported content depend on the related <level> parameter value (details are given above). |
<opt_val> | Number | Type and supported content depend on the related <level> parameter value (details are given above). |
<opt_val2> | Number | Type and supported content depend on the related <level> parameter value (details are given above). |
<level>=65535 (socket), <opt_name>=512 (local address and port re-use) is not supported.
+USOGO | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Retrieves the specified standard option (type of service, local address re-use, linger time, time-to-live, etc) for the specified socket, like the BSD getsockopt routine.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USOGO=<socket>,<level>,<opt_name> | +USOGO: <opt_val>[,<opt_val2>] OK | AT+USOGO=0,0,2 +USOGO: 255 OK |
Test | AT+USOGO=? | +USOGO: (list of supported <socket>s),(list of supported <level>s) OK | +USOGO: (0-6),(0,6,65535) OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<level> | Number |
|
<level>=65535 (socket), <opt_name>=512 (local address and port re-use) is not supported.
+USOCL | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
partial | No | No | No |
Closes the specified socket, like the BSD close routine. In case of remote socket closure the user is notified via the URC.
By default the command blocks the AT command interface until the completion of the socket close operation. By enabling the <async_close> flag, the final result code is sent immediately. The following +UUSOCL URC will indicate the closure of the specified socket.
The command response time may vary depending on the module series. For more details, see the Estimated maximum command response time.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USOCL=<socket>[,<async_close>] | OK | AT+USOCL=2 OK |
Test | AT+USOCL=? | +USOCL: (list of supported <socket>s) OK | +USOCL: (0-6),(0-1) OK |
URC | +UUSOCL: <socket> | +UUSOCL: 2 |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<async_close> | Number | Asynchronous close flag. The flag has effect for TCP connections only. Allowed values:
|
The <async_close> parameter is not supported.
+USOER | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Retrieves the last error occurred in the last socket operation, stored in the BSD standard variable error.
Type | Syntax | Response | Example |
---|---|---|---|
Action | AT+USOER | +USOER: <socket_error> OK | +USOER: 104 OK |
Set | AT+USOER=<cid> | +USOER: <socket_error> OK | +USOER: 104 OK |
Parameter | Type | Description |
---|---|---|
<cid> | Number | Retrieve error on the specific <cid> listed using +CGDCONT AT command. Minimum and maximum values depends on platform specification. |
<socket_error> | Number | Code of the last error occurred in a socket operation. The allowed values are listed in Internal TCP/UDP/IP stack class error codes:
|
The <cid> parameter is not supported.
+USOCO | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
partial | No | No | No |
Establishes a peer-to-peer connection of the socket to the specified remote host on the given remote port, like the BSD connect routine. If the socket is a TCP socket, the command will actually perform the TCP negotiation (3-way handshake) to open a connection. If the socket is a UDP socket, this function will just declare the remote host address and port for later use with other socket operations (e.g. +USOWR, +USORD). This is important to note because if <socket> refers to a UDP socket, errors will not be reported prior to an attempt to write or read data on the socket.
The estimated response time depends also by the DNS resolution. For further details about the estimated response time related to the DNS resolution, see the +UDNSRN AT command.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USOCO=<socket>,<remote_addr>,<remote_port>[,<async_connect>] | OK | AT+USOCO=3,"151.63.16.9",1200 OK |
AT+USOCO=2,"151.63.16.9",8200,1 OK +UUSOCO: 2,0 | |||
AT+USOCO=2,"151.63.16.9",8230,0 OK | |||
Test | AT+USOCO=? | +USOCO: (list of supported <socket>s),"remote_host",(list of supported <remote_port>s),(list of supported <async_connect>s) OK | +USOCO: (0-6),"remote_host",(1-65535),(0-1) OK |
URC | +UUSOCO: <socket>,<socket_error> | +UUSOCO: 2,0 |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<remote_addr> | String | Remote host IP address or domain name of the remote host. For IP address format reference see the IP addressing. |
<remote_port> | Number | Remote host port, in range 1-65535 |
<async_connect> | Number | Asynchronous connect flag. The flag has effect for TCP connections only. Allowed values:
|
<socket_error> | Number | Code of the last error occurred in a socket operation. The allowed values are listed in Internal TCP/UDP/IP stack class error codes:
|
In case of the socket connection with the asynchronous flag:
the socket will be closed if a further +USOCO AT command is issued before having received the +UUSOCO URC of the first AT command.
it is not possible to connect a second socket before the reception of the +UUSOCO URC related to the pending socket connection.
+USOWR | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
partial | No | No | No |
Writes the specified amount of data to the specified socket, like the BSD write routine, and returns the number of bytes of data actually written. The command applies to UDP sockets too, after a +USOCO command.
There are three kinds of syntax:
Base syntax normal: writing simple strings to the socket, some characters are forbidden
Base syntax HEX: writing hexadecimal strings to the socket, the string will be converted in binary data and sent to the socket; see the AT+UDCONF=1 command description to enable it
Binary extended syntax: mandatory for writing any character in the ASCII range [0x00, 0xFF]
Regarding the TCP socket:
If no network signal is available, the TCP packets are enqueued until the network will become available again. If the TCP queue is full the +USOWR command will return an error result code. To get the last socket error use the +USOCTL=1 command. If the error code returned is 11, it means that the queue is full.
If the connection is closed by the remote host, the +UUSOCL URC is not sent until all received data is read using the AT+USORD command. If AT+USOWR command is used in this situation, an error result code is returned. See also the Notes section about the specific product behavior
If the connection is closed by the remote host and binary interface started with AT+USOWR command is still waiting for data, an error result code is returned indicating that the binary interface was closed. After the error result code a +UUSOCL URC is reported indicating that the socket was closed.
Regarding the UDP socket:
The information text response indicates that data has been sent to lower level of protocol stack. This is not an indication of an acknowledgment received by the remote server the socket is connected to.
The command response time may vary depending on the module series. For more details, see the Estimated maximum command response time.
Type | Syntax | Response | Example |
---|---|---|---|
Base syntax | |||
Set | AT+USOWR=<socket>,<length>,<data> | +USOWR: <socket>,<length> OK | AT+USOWR=3,12,"Hello world!" +USOWR: 3,12 OK |
Binary syntax | |||
Set | AT+USOWR=<socket>,<length> | @<data> +USOWR: <socket>,<length> OK | AT+USOWR=3,16 @16 bytes of data +USOWR: 3,16 OK |
Test | AT+USOWR=? | +USOWR: (list of supported <socket>s),(list of supported <length>s),"HEX data" +USOWR: (list of supported <socket>s),(list of supported <length>s),"data" +USOWR: (list of supported <socket>s),(list of supported <length>s) OK | +USOWR: (0-6),(0-512),"HEX data" +USOWR: (0-6),(0-1024),"data" +USOWR: (0-6),(0-1024) OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<length> | Number | Number of data bytes to write:
|
<data> | String | Data bytes to be written. Not all of the ASCII charset can be used. |
For base syntax:
The value of <length> and the actual length of <data> must match
For base syntax HEX mode:
Only the ASCII characters 0-9, A-F and a-f are allowed.
The length of the <data> parameter must be two times the <length> parameter.
For binary syntax:
After the command is sent, the user waits for the @ prompt. When it appears the stream of bytes can be provided. After the specified amount of bytes has been sent, the system provides the final result code. The feed process cannot be interrupted i.e. the return in the command mode can be effective only when the number of bytes provided is the declared one.
After the @ prompt reception, wait for a minimum of 50 ms before sending data.
The binary extended syntax is the only way for the system to accept control characters as data; for the AT command specifications 3GPP TS 27.005 [27.005], characters like <CR>, <CTRL-Z>, quotation marks, etc. have a specific meaning and they cannot be used like data in the command itself. The command is so extended with a specific acceptance state identified by the @ prompt.
This feature can be successfully used when there is need to send a byte stream which belongs to a protocol that has any kind of characters in the ASCII range [0x00,0xFF].
In binary mode the module does not display the echo of data bytes.
Binary syntax is not affected by HEX mode option.
For <data> parameter not all of the ASCII charset can be used.
+USOWR binary mode sets the AT terminal to direct link mode, thus direct link limitations apply for this command as well. Only one direct link connection at a time can be activated. When considering the number of active direct links, take into account also the connection established by the +USODL AT command, the UHTTP direct link mode (see parameters http_command=6 and http_command=7 in +UHTTPC command), the UMQTT binary mode (see parameter op_code=9 in +UMQTTC to publish a binary message to a topic) and the +FREAD AT command.
+USOST | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No |
Writes the specified amount of data to the remote address, like the BSD sendto routine, and returns the number of bytes of data actually written. It can be applied to UDP sockets only. This command allows the reuse of the same socket to send data to many different remote hosts.
There are three kinds of syntax:
Base syntax normal: writing simple strings to the socket, there are characters which are forbidden.
Base syntax HEX: writing hexadecimal strings to the socket, the string will be converted in binary data and sent to the socket. To enable it, see the AT+UDCONF=1 command description.
Binary extended syntax: mandatory for writing any character in the ASCII range [0x00, 0xFF].
If no network signal is available, outcoming UDP packet may be lost.
The information text response to the test command provides the information about the binary extended syntax only where supported.
The command response time may vary depending on the module series. For more details, see the Estimated maximum command response time.
In binary mode the command will never return if less characters than the expected length are issued after the prompt.
Type | Syntax | Response | Example |
---|---|---|---|
Base syntax | |||
Set | AT+USOST=<socket>,<remote_addr>,<remote_port>,<length>,<data>,[<seq_no>] | +USOST: <socket>,<length> OK | AT+USOST=3,"151.9.34.66",449,16,"16 bytes of data" +USOST: 3,16 OK |
Binary syntax | |||
Set | AT+USOST=<socket>,<remote_addr>,<remote_port>,<length> After the"@" prompt <length> bytes of data are entered | @<data> +USOST: <socket>,<length> OK | AT+USOST=3,"151.9.34.66",449,16 @16 bytes of data +USOST: 3,16 OK |
Test | AT+USOST=? | +USOST: (list of supported <socket>s),"remote_host",(list of supported <remote_port>s),(list of supported <length>s),(list of supported <seq_no>s),"HEX data" +USOST: (list of supported <socket>s),"remote_host",(list of supported <remote_port>s),(list of supported <length>s),(list of supported <seq_no>s),"data" [+USOST: (list of supported <socket>s),"remote_host",(list of supported <remote_port>s),(list of supported <length>s)] OK | +USOST: (1-8),"remote_host",(1-65535),(1-512),(1-255),"HEX data" +USOST: (1-8),"remote_host",(1-65535),(1-1024),(1-255),"data" OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<remote_addr> | String | Remote host IP address or domain name of the remote host. For IP address format reference, see the IP addressing. |
<remote_port> | Number | Remote host port, in range 1-65535 |
<length> | Number | Number of data bytes to write:
|
<data> | String | Data bytes to be written (not all of the ASCII charset can be used) |
For base syntax:
The value of <length> and the actual length of <data> must match
For base syntax HEX mode, only ASCII characters 0-9, A-F and a-f are allowed. The length of the <data> parameter must be two times the <length> parameter
For binary syntax:
After the command is sent, the user waits for the @ prompt. When it appears the stream of bytes can be provided. After the specified amount of bytes has been sent, the system returns with final result code. The feed process cannot be interrupted i.e. the return in the command mode can be effective only when the number of bytes provided is the declared one
That binary extended syntax is the only way for the system to accept control characters as data; for the AT command specifications [27.005], characters like <CR>, <CTRL-Z>, quotation marks, etc. have a specific meaning and they cannot be used like data in the command itself. The command is so extended with a specific acceptance state identified by the @ prompt
This feature can be successfully used when there is need to send a byte stream which belongs to a protocol that has any kind of characters in the ASCII range [0x00,0xFF]
In binary mode the module does not display the echo of data bytes
Binary syntax is not affected by HEX mode option
In binary mode the command response time value specified in Estimated command response time takes effect after the last expected character has been issued
+USORD | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No |
Reads the specified amount of data from the specified socket, like the BSD read routine. This command can be used to know the total amount of unread data.
For the TCP socket type the URC +UUSORD: <socket>,<length> notifies the data bytes available for reading, either when buffer is empty and new data arrives or after a partial read by the user.
For the UDP socket type the URC +UUSORD: <socket>,<length> notifies that a UDP packet has been received, either when buffer is empty or after a UDP packet has been read and one or more packets are stored in the buffer.
In case of a partial read of a UDP packet +UUSORD: <socket>,<length> will show the remaining number of data bytes of the packet the user is reading.
If the UART interface of the application processor has a RX FIFO of only 1 character, it is highly recommended to set the <length> parameter lower than 64.
(about UDP socket) Due to the UDP specific AT command, it is preferred to use the +USORF command to read data from UDP socket. +USORF command does not require the usage of +USOCO before reading data.
When applied to UDP active sockets if the UDP socket is not set in listening mode (see +USOLI) it will not be possible to receive any packet if a previous write operation is not performed.
If the HEX mode is enabled (refer to AT+UDCONF=1 command) the received data will be displayed using an hexadecimal string.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USORD=<socket>,<length> | +USORD: <socket>,<length>,<data in the ASCII [0x00,0xFF] range> OK | AT+USORD=3,16 +USORD: 3,16,"16 bytes of data" OK |
Test | AT+USORD=? | +USORD: (list of supported <socket>s),(list of supported <length>s) OK | +USORD: (0-6),(0-1024) OK |
URC | +UUSORD: <socket>,<length> | +UUSORD: 3,16 |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<length> | Number | Number of data bytes
|
<data> | String | Data bytes to be read |
The returned data may be any ASCII character in the range [0x00,0xFF] i.e. control characters. The starting quotation marks shall not be taken into account like data; the first byte of data starts after the first quotation marks. Then the other characters are provided for a <length> amount. An application should rely on the <length> info to count the received number of characters (after the starting quotation marks) especially if any protocol control characters are expected.
If an application deals with letter and number characters only i.e. all of the expected characters are outside the [0x00, 0x1F] range and are not quotation marks, the AT+USORD response quotation marks can be assumed to identify the start and the end of the received data packet. Always check <length> to identify the valid data stream.
If the number of data bytes requested to be read from the buffer is bigger than the number of bytes stored in the buffer only the available amount of data bytes will be read.
When <length>= 0, the command returns the total amount of data present in the network buffer. Example: 23 unread bytes in the socket.
AT+USORD=3,0 +USORD: 3,23 OK
If the HEX mode is enabled, the length of <data> will be 2 times <length>.
+USORF | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No |
Reads the specified amount of data from the specified UDP socket, like the BSD recvfrom routine. The URC +UUSORF: <socket>,<length> (or also +UUSORD: <socket>,<length>) notifies that new data is available for reading, either when new data arrives or after a partial read by the user for the socket. This command can also return the total amount of unread data.
This command can be applied to UDP sockets only, and it can be used to read data after both +UUSORD and +UUSORF unsolicited indication.
If the HEX mode is enabled (see +UDCONF=1) the received data will be displayed using an hexadecimal string.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USORF=<socket>,<length> | +USORF: <socket>,<remote_ip_addr>,<remote_port>,<length>,<data in the ASCII [0x00,0xFF] range> OK | AT+USORF=3,16 +USORF: 3,"151.9.34.66",2222,16,"16 bytes of data" OK |
Test | AT+USORF=? | +USORF: (list of supported <socket>s),(list of supported <length>s) OK | +USORF: (0-6),(0-1024) OK |
URC | +UUSORF: <socket>,<length> | +UUSORF: 3,16 |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<remote_ip_addr> | String | Remote host IP address. For IP address format reference see the IP addressing. |
<remote_port> | Number | Remote host port, in range 1-65535 |
<length> | Number | Number of data bytes to read stored in buffer (if in the set command), or read from the buffer (if in the information text response to the set command), or stored in the buffer (for the URC). The allowed range when issued in the set command or returned in the information text response is:
|
<data> | String | Data bytes to be read |
Each packet received from the network is stored in a separate buffer and the command is capable to read only a packet (or e portion of it) at time. This means that if <length> is greater than the packet size, the command will return a maximum amount of data equal to the packet size, also if there are other packets in the buffer. The remaining data (i.e. the remaining UDP packets) can be read with further reads.
The returned data may have any kind of ASCII character in the range [0x00,0xFF] i.e. control characters too. The starting quotation marks shall not be taken into account like data; the first byte of data starts after the first quotation marks. Then the other characters are provided for a <length> amount. At the end of the length byte stream, another quotation marks followed by <CR><LF> are provided for user convenience and visualization purposes. An application should rely on the <length> info to count the received number of characters (after the starting quotation marks) especially if any protocol control characters are expected.
If an application deals with letter and number characters only i.e. all of the expected characters are outside the [0x00, 0x1F] range and are not quotation marks, the AT+USORD response quotation marks can be assumed to identify the start and the end of the received data packet, anyway the <length> field usage to identify the valid data stream is recommended.
When <length>= 0, the command returns the total amount of data present in the network buffer. Example: 23 unread bytes in the socket.
AT+USORF=3,0 +USORF: 3,23 OK
If the HEX mode is enabled, the length of <data> will be 2 times <length>.
+USOLI | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No |
Sets the specified socket in listening mode on the specified port of service, waiting for incoming connections (TCP) or data (UDP):
For TCP sockets, incoming connections will be automatically accepted and notified via the URC +UUSOLI: <socket>,<ip_address>,<port>,<listening_socket>,<local_ip_address>,<listening_port>, carrying the connected socket identifier, the remote IP address and port.
For UDP sockets, incoming data will be notified via URC +UUSORF: <listening_socket>,<length>. To know from which remote IP address and port the data is coming from, use the AT+USORF command.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USOLI=<socket>,<port> | OK | TCP sockets AT+USOLI=2,1200 OK +UUSOLI: 3,"151.63.16.7",1403,2,"82.89.67.164",1200 |
UDP sockets AT+USOLI=0,1182 OK +UUSORF: 0,1024 | |||
Test | AT+USOLI=? | +USOLI: (list of supported <socket>s),(list of supported <port>s) OK | +USOLI: (0-6),(1-65535) OK |
URC (TCP) | +UUSOLI: <socket>,<ip_address>,<port>,<listening_socket>,<local_ip_address>,<listening_port> | +UUSOLI: 3,"151.63.16.7",1403,0,"82.89.67.164",200 | |
URC (UDP) | +UUSORF: <listening_socket>,<length> | +UUSORF: 1,967 |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<port> | Number | Port of service, range 1-65535. Port numbers below 1024 are not recommended since they are usually reserved |
<ip_address> | String | Remote host IP address (only in URC +UUSOLI). For IP address format reference see the IP addressing. |
<listening_socket> | Number | Socket identifier specified within the AT+USOLI command, indicates on which listening socket the connection has been accepted (only in +UUSOLI URC) |
<local_ip_address> | String | TE IP address (only in +UUSOLI URC). For IP address format reference see the IP addressing. |
<listening_port> | Number | Listening port that has accepted the connection. This port is specified within the AT+USOLI command (only in +UUSOLI URC) |
<length> | Number | Data length received on the UDP listening socket (only in +UUSORF unsolicited indication). In order to know the sender IP address and port, use the AT+USORF command. |
In case of notification via the URC +UUSOLI <port> is intended as the remote port.
No more than 3 TCP sockets can be set in listening mode.
+UDCONF=1 | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Enables/disables the HEX mode for +USOWR, +USOST, +USORD and +USORF AT commands.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UDCONF=1,<enable_hex_mode> | OK | AT+UDCONF=1,0 OK |
Read | AT+UDCONF=1 | +UDCONF: 1,<enable_hex_mode> OK | AT+UDCONF=1 +UDCONF: 1,1 OK |
Parameter | Type | Description |
---|---|---|
<enable_hex_mode> | Number | Enables/disables the HEX mode for +USOWR, +USOST, +USORD and +USORF AT commands. Allowed values:
|
+USODL | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No |
Establishes a transparent end-to-end communication with an already connected TCP or UDP socket via the serial interface. The data can be sent to the socket and can be received via the serial interface: the HW flow control usage is strongly recommended to avoid data loss.
The transparent TCP/UDP connection mode can be exited via the +++ sequence, entered after at least 2 s of suspension of transmission to the port or via the DTR line transition according the &D configuration. The socket will remain connected and communication can be re-established any time.
When the transparent communication is exited, the DISCONNECT intermediate result code is sent to the terminal to notify the disconnection. The DISCONNECT intermediate result code is preceeded and followed by a <CR><LF> (ASCII 0x0D 0x0A) sequence.
The host application shall monitor the serial port for the complete <CR><LF>DISCONNECT<CR><LF> sequence to detect unexpected termination of the transparent communication. When the direct link mode is exited due to abnormal cases like the elapsing of the congestion timer (see Congestion timer), or a failed registration due to mobility, the DISCONNECT intermediate result code is followed by an ERROR final result code.
The number of sockets that can be connected in direct link mode is usually limited by the number of AT terminals that can be used in parallel; exceptions are specified in the Notes.
Escape sequence +++ is detected when it is received by the module in a single separate frame of 3 bytes length: to avoid missed detection of the escape sequence, it is suggested to send +++ when the COM port has CTS asserted/flow control disabled. For more details, see the LEXI-R10 series Internet applications development guide [UBXDOC-686885345-2004].
When using Direct Link with UDP sockets, if no network signal is available, outgoing UDP packet may be lost.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USODL=<socket> | Normal exit CONNECT DISCONNECT OK | AT+USODL=0 CONNECT … data … +++ (user terminates the direct link) DISCONNECT OK |
Abnormal exit CONNECT DISCONNECT ERROR | AT+USODL=0 CONNECT Abnormal event (congestion, NW detach) DISCONNECT ERROR | ||
Test | AT+USODL=? | +USODL: (list of supported <socket>s) OK | +USODL: (0-6) OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
Only one direct link connection at a time can be activated. When considering the number of active direct links, take into account also the connection established by the UHTTP direct link mode (see parameters http_command=6 and http_command=7 in +UHTTPC command), the UMQTT binary mode (see parameter op_code=9 in +UMQTTC to publish a binary message to a topic), the +USOWR AT command for binary mode and the +FREAD AT command.
Character Trigger not supported.
The enhanced DL functionality allows the user set up to three kinds of trigger for data transmission:
Timer Trigger
Data Length Trigger
Character Trigger
The triggers can be applied independently to each socket. A socket may be set with more than one trigger.
The trigger must be set after the socket creation and before switching to direct link mode.
By default Timer Trigger and Data Length Trigger are enabled for UDP sockets.
By default no triggers are enabled for TCP sockets.
The user can configure a timeout for sending the data. The timer starts every time a character is read from the serial interface. When the timer expires, buffered data is sent.
The timer range is between 100 and 120000 ms.
The +UDCONF=5 command can configure the timer trigger.
The user can configure a maximum buffered data length to reach before sending the data. When this length is reached the data is sent.
The minimum data length is 3, the maximum data length is 2048 bytes for TCP and 1472 bytes for UDP.
The +UDCONF=6 command can configure the data length trigger.
The user can configure a character that will trigger the data transmission. When the character is detected the data (including the trigger character) is sent.
If the specified character is -1, the character trigger is disabled.
By default it is disabled for both TCP and UDP sockets.
The +UDCONF=7 command can configure the character trigger.
The user can enable multiple triggers together. The triggers work with an OR logic. This means that the first trigger reached fires the data transmission.
A data chunk is the amount of data that SIO recognizes as a single data transmission.
If the baud rate is lower than 115200 b/s the time to receive 255 characters is always calculated with timings for 115200 b/s.
The data received from the network is immediately forwarded to the serial interface.
The congestion timer represents the time after which, in case of network congestion, the module exits from direct link.
+UDCONF=5 | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Sets the timer trigger of the interested socket identifier for the data transmission enhanced Direct Link.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UDCONF=5,<socket_id>,<timer_trigger> | OK | AT+UDCONF=5,0,500 OK |
Read | AT+UDCONF=5,<socket_id> | +UDCONF: 5,<socket_id>,<timer_trigger> OK | AT+UDCONF=5,0 +UDCONF: 5,0,500 OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. To be used when changing the UDP Direct Link settings. |
<timer_trigger> | Number | Enhanced Direct Link sending timer trigger (in milliseconds); valid range is 0 (trigger disabled), 100-120000;
|
+UDCONF=6 | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Sets the data length trigger of the interested socket identifier for the data transmission enhanced Direct Link.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UDCONF=6,<socket_id>,<data_length_trigger> | OK | AT+UDCONF=6,0,1024 OK |
Read | AT+UDCONF=6,<socket_id> | +UDCONF: 6,<socket_id>,<data_length_trigger> OK | AT+UDCONF=6,0 +UDCONF: 6,0,1024 OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. To be used when changing the UDP Direct Link settings. |
<data_length_trigger> | Number | Enhanced Direct Link data length trigger in bytes, valid range is 0, 3-1472 for UDP and 0, 3-2048 for TCP, the factory-programmed value is 1024 for UDP, 0 for TCP, 0 means trigger disabled. |
+UDCONF=8 | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Sets the congestion timer of the interested socket identifier for the data transmission enhanced Direct Link.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UDCONF=8,<socket_id>,<congestion_timer> | OK | AT+UDCONF=8,0,120000 OK |
Read | AT+UDCONF=8,<socket_id> | +UDCONF: 8,<socket_id>,<congestion_timer> OK | AT+UDCONF=8,0 +UDCONF: 8,0,120000 OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. To be used when changing the Direct Link settings. |
<congestion_timer> | Number | Enhanced Direct Link congestion timer (in milliseconds); valid range is 0, 1000-720000; the factory-programmed value is 60000, 0 means trigger disabled. |
+UDCONF=101 | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | - |
Configures the discard of received TCP packets not fitting the available window size, which is often required for better interoperability with mobile networks. If discard is enabled, a TCP packet larger than the window size is discarded. If discard is disabled, a TCP packet exceeding the window size is partially received and acknowledged for the part fitting the window size, and the exceeding part is discarded.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UDCONF=101,<discard> | OK | AT+UDCONF=101,1 OK |
Read | AT+UDCONF=101 | +UDCONF: 101,<discard> OK | +UDCONF: 101,1 OK |
Parameter | Type | Description |
---|---|---|
<discard> | Number | TCP packets discard option:
|
+USOCTL | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
partial | No | No | No | - |
Allows interaction with the low level socket layer.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+USOCTL=<socket>,<param_id> | +USOCTL: <socket>,<param_id>,<param_val>[,<param_val2>] OK | AT+USOCTL=0,2 +USOCTL: 0,2,38 OK |
Test | AT+USOCTL=? | +USOCTL: (list of supported <socket>s),(list of supported <param_id>s) OK | +USOCTL: (0-6),(0-4,10-11) OK |
Parameter | Type | Description |
---|---|---|
<socket> | Number | See <socket>. |
<param_id> | Number | Control request identifier:
Allowed values:
|
<param_val> | Number / String | This value may assume different means depending on the <param_id> parameter. If <param_id>=0, <param_val> can assume these values:
If <param_id>=1, <param_val> can assume these values:
If <param_id>=2, <param_val> can assume these values:
If <param_id>=3, <param_val> can assume these values:
If <param_id>=4, <param_val> can assume these values:
If <param_id>=10, <param_val> can assume these values:
If <param_id>=11, <param_val> can assume these values:
|
<param_val2> | Number | This value is present only when <param_id> is 4. It represents the remote peer IP port. For IP address format reference see the IP addressing. |
+UIPERF | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Measures the throughput of IP traffic on the cellular network. It supports tuning of various parameters related to timing, buffers and protocols (TCP and UDP with IPv4 and IPv6).The +UUIPERF URC reports the IPERF service result.
The command setting is volatile.
The “+UUIPERF: Server/Client END” URCs report the average throughput considering the whole time the server/client have been running.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UIPERF=<action>[,<protocol>[,<port>[,<ipaddr>[,<tpt>[,<payload_size>[,<packet_number>[,<duration>[,<report_interval>]]]]]]]] | OK | AT+UIPERF=1,1,8080,"10.0.0.1",10000,1472,10,30 OK |
Test | AT+UIPERF=? | +UIPERF: (list of supported <action>s),(list of supported <protocol>s),(list of supported <port>s), (list of supported <tpt>s),(list of supported <payload_size>s),(list of supported <packet_number>s), (list of supported <duration>s),(list of supported <report_interval>s) OK | +UIPERF: (0-5),(0,1),(1-65535),(1-12000000),(36-1472),(0-65000),(1-65000),(1-65000) OK |
Client mode (<action>=1,2) | |||
URC | IPERF client IP throughput progress +UUIPERF: Client PROGRESS, sent bytes: <num_bytes>, UL throughput: <tpt> | +UUIPERF: Client PROGRESS, sent bytes: 1621, UL throughput: 1831 | |
URC | IPERF client IP throughput end +UUIPERF: Client END, sent bytes: <num_bytes>, UL throughput: <tpt> | +UUIPERF: Client END, sent bytes: 13720, UL throughput: 10976 | |
URC | IPERF client error +UUIPERF: Client FAIL, <err> | +UUIPERF: Client FAIL, 3 | |
Server mode (<action>=3,4,5) | |||
URC | IPERF server IP throughput progress +UUIPERF: Server PROGRESS, recv bytes: <num_bytes>, DL throughput: <tpt> | +UUIPERF: Server PROGRESS, recv bytes: 560, DL throughput: 1165 | |
URC | IPERF Server IP throughput end +UUIPERF: Server END, recv bytes: <num_bytes>, DL throughput: <tpt> | +UUIPERF: Server END, recv bytes: 2829, DL throughput: 3487 | |
URC | IPERF Server error +UUIPERF: Server FAIL, <err> | +UUIPERF: Server FAIL, 2 |
Parameter | Type | Description |
---|---|---|
<action> | Number | Represents the IPERF services. Allowed values:
|
<protocol> | Number | Represents the transport protocol:
|
<port> | Number | UDP/TCP port number. The range goes from 1 to 65535. The default value is 5001.
|
<ipaddr> | String | IP address
|
<tpt> | Number | Throughput expressed in bit/s. The range goes from 1 to 12000000. The default value is 20000. |
<payload_size> | Number | Payload size of UL UDP/TCP IPERF packet. The range goes from 36 to 1472. The default value is 1350. |
<packet_number> | Number | Number of packets the UE will send, when working in client mode. The range goes from 0 to 65000. The default value is 0, indicates that the UE will continously send packets. |
<duration> | Number | IPERF service duration, expressed in seconds. The range goes from 1 to 65000. The default value is 65000, indicates that the IPERF would not stop before encountering an error or receiving a terminate command. |
<report_interval> | Number | Indicates the reporting interval of the +UUIPERF URCs. The reporting interval is expressed in seconds. The range goes from 1 to 65000. The default value is 10. |
<num_bytes> | Number | Indicates the number of sent bytes in client mode and number of received bytes in server mode. |
<err> | Number | Indicates the error result code for both client and server mode:
|