User Manual

Table Of Contents
SARA-R4 series-AT commands manual
UBX-17003787 - R16
19Internet protocol transport layer
Page 218 of 401
SARA-R4 / SARA-N4
The <seq_no> parameter and the +UUSOST URC are not supported.
19.12Read Socket Data +USORD
+USORD
Modules All products
Syntax PIN required Settings saved Can be aborted Response time Error referenceAttributes
full No No No < 1 s (except
URC)
+CME Error
19.12.1Description
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.
19.12.2Syntax
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
19.12.3Defined values
Parameter Type Description
<socket> Number Socket identifier.
SARA-R4 / SARA-N4 - The range goes from 0 to 6.
<length> Number Number of data bytes
to read stored in buffer, in range 0-1024 in the set command
read from buffer, in range 0-1024
stored in buffer for the URC
<data> String Data bytes to be read