Internet protocol transport layer

Introduction

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

<socket>

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

IPv4/IPv6 addressing

Introduction

The section describes the IP addressing formats and IP address rules used by TCP/IP UDP/IP enabled applications.

IPv4

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

IPv6

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:

For packet switched services AT commands (i.e. PDP_addr in +CGDCONT) the format is specified in the corresponding command section.

Sockets Always On feature

Introduction

The section describes the Socket Always On feature and how it affects the module’s operations in power saving.

Description

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.

To know if a socket is set as Always On use the <report_AoN> parameter when creating a socket with the +USOCR AT command. The +USOCR read command reports also the Always On attribute of all created sockets.

Create Socket +USOCR

+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

-

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<protocol>

Number

Allowed values:

  • 6: TCP

  • 17: UDP

<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:

  • 0: IPv4

  • 1: IPv6

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

  • 0 (default value): do not report the AoN attribute

  • 1: report the AoN attribute

<AoN_state>

Number

Specifies if the socket is configured as Always On (AoN).

  • 0: socket is not AoN

  • 1: socket is AoN

SSL/TLS/DTLS mode configuration on TCP/UDP socket +USOSEC

+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

Estimated maximum command response time

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<socket>

Number

See <socket>.

<ssl_tls_dtls_status>

Number

  • 0 (default value): disable the SSL/TLS/DTLS on the socket.

  • 1: enable the socket security; a USECMNG profile can be specified with the <usecprf_profile_id> parameter.

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

Set socket option +USOSO

+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

-

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<socket>

Number

See <socket>.

<level>

Number

Allowed values:

  • 0: IP protocol

    <opt_name> for IP protocol level may be:

    • 1: type of service (TOS)

      <opt_val>: 8 bitmask that represents the flags of IP TOS. The range is 0-255 (the default value is 0). For more information, see the RFC 791 [RFC791]

    • 2: time-to-live (TTL)

      <opt_val>: unsigned 8 bit value representing the TTL. The range is 0-255 (the default value is 255)

  • 6: TCP protocol

    <opt_name> for TCP protocol level may be:

    • 1: no delay option; do not delay send to coalesce packets;

      <opt_val>: numeric parameter, it enables/disables the "no delay" option:

      • 0 (default value): disabled

      • 1: enabled

    • 2: keepidle option: send keepidle probes when it is idle for <opt_val> milliseconds

      <opt_val>: signed 32 bit numeric parameter representing the milliseconds for "keepidle" option. The range is 0-2147483647. The default value is 7200000 (2 hours)

  • 65535: socket

    <opt_name> for socket level options may be:

    • 4: local address re-use.

      <opt_val>: numeric parameter, it configures the "local address re-use" option.

      • 0 (default value): disabled

      • 1: enabled

    • 8: keep connections alive.

      <opt_val>: numeric parameter, it configures "keep connections alive" option.

      • 0 (default value): disabled

      • 1: enabled

    • 32: sending of broadcast messages.

      <opt_val>: numeric parameter, it configures "sending of broadcast messages".

      • 0 (default value): disabled

      • 1: enabled

    • 128: linger on close if data present.

      <opt_val>: numeric parameter, it configures the "linger" option.

      • 0 (default value): disabled

      • 1: enabled

      <opt_val2>: signed 16 bit numeric parameter, it sets the linger time, the range goes from 0 to 32767 in seconds. The default value is 0.

    • 512: local address and port re-use.

      <opt_val>: numeric parameter, it configures the "local address and port re-use".

      • 0 (default value): disabled

      • 1: enabled

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

Notes

  • <level>=65535 (socket), <opt_name>=512 (local address and port re-use) is not supported.

Get Socket Option +USOGO

+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

-

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<socket>

Number

See <socket>.

<level>

Number

  • 0: IP Protocol

    <opt_name> for IP protocol level may be:

    • 1: type of service

      <opt_val>: 8 bit mask that represents the flags of IP TOS. For more information see the RFC 791 [RFC791]. The range is 0-255. The default value is 0

    • 2: time-to-live

      <opt_val>: unsigned 8 bit value representing the TTL. The range is 0-255. The default value is 0.

  • 6: TCP Protocol

    <opt_name> for TCP protocol level may be:

    • 1: no delay option: do not delay send to coalesce packets

      <opt_val>: numeric parameter, it enables/disables the "no delay" option

      • 0 (default value): disabled

      • 1: enabled

    • 2: keepidle option: send keepidle probes when idle for <opt_val> milliseconds

      <opt_val>: signed 32 bit number value representing the milliseconds for "keepidle" option. The range 0-2147483647. The default value is 7200000 (2 hours)

  • 65535: socket

    <opt_name> for the socket level options may be:

    • 4: local address re-use

      <opt_val>: numeric parameter, it configures the "local address re-use" option:

      • 0 (default value): disabled

      • 1: enabled

    • 8: keep connections alive

      <opt_val>: numeric parameter, it configures the "keep connections alive" option:

      • 0 (default value): disabled

      • 1: enabled

    • 32: sending of broadcast messages

      <opt_val>: numeric parameter, it configures the "sending of broadcast messages":

      • 1: enabled

      • 0 (default value): disabled

    • 128: linger on close if data present

      <opt_val>: numeric parameter, it sets on/off the "linger" option.

      • 0 (default value): disabled

      • 1: enabled

      <opt_val2>: signed 16 bit numeric value, linger time, the range goes from 0 to 32767 in seconds. The default value is 0.

    • 512: local address and port re-use

      <opt_val>: numeric parameter, it enables/disables "local address and port re-use":

      • 0 (default value): disabled

      • 1: enabled

Notes

  • <level>=65535 (socket), <opt_name>=512 (local address and port re-use) is not supported.

Close Socket +USOCL

+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

Estimated maximum command response time

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<socket>

Number

See <socket>.

<async_close>

Number

Asynchronous close flag. The flag has effect for TCP connections only. Allowed values:

  • 0 (default value): the operation result is returned only once the result of the TCP close becomes available, locking the AT interface until the connection closes.

  • 1: the final result code is returned immediately unlocking the AT interface and making it available for the execution of other AT commands. Once the result of TCP close becomes available, it is notified to the AT interface through the +UUSOCL URC.

Notes

  • The <async_close> parameter is not supported.

Get Socket Error +USOER

+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

-

TCP/UDP/IP Error

+CME Error

Description

Retrieves the last error occurred in the last socket operation, stored in the BSD standard variable error.

Syntax

TypeSyntaxResponseExample

Action

AT+USOER

+USOER: <socket_error>

OK

+USOER: 104

OK

Set

AT+USOER=<cid>

+USOER: <socket_error>

OK

+USOER: 104

OK

Defined values

ParameterTypeDescription

<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:

  • 0: no error

Notes

  • The <cid> parameter is not supported.

Connect Socket +USOCO

+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

Estimated maximum command response time

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<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:

  • 0 (default value): the operation result is returned only once the TCP connection is established, locking the AT interface until the connection activity is running

  • 1: the final result code is returned immediately unlocking the AT interface and making it available for the execution of other AT commands. Once the result of TCP connection becomes available, it is notified to the AT interface through the +UUSOCO URC.

<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:

  • 0: no error, connection successful

Notes

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

Write socket data +USOWR

+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

Estimated maximum command response time

+CME Error

Description

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:

  • Due to the UDP specific AT commands, it is preferred to use the +USOST command to send data via UDP socket. This command does not require the usage of +USOCO before sending data.

  • If no network signal is available, out going UDP packet may be lost.

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<socket>

Number

See <socket>.

<length>

Number

Number of data bytes to write:

  • Base syntax normal mode: range 1-1024

  • Base syntax HEX mode: range 1-512

  • Binary extended syntax: range 1-1024

<data>

String

Data bytes to be written. Not all of the ASCII charset can be used.

Notes

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

SendTo command (UDP only) +USOST

+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

Estimated maximum command response time

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<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:

  • LEXI-R10

    • Base syntax normal mode: range 1-1024

    • Base syntax HEX mode: range 1-512

    • Binary syntax mode: range 1-1024

<data>

String

Data bytes to be written (not all of the ASCII charset can be used)

Notes

  • 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

Read Socket Data +USORD

+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

Estimated maximum command response time

+CME Error

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<socket>

Number

See <socket>.

<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

Notes

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

Receive From command (UDP only) +USORF

+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

< 1 s (except URC)

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<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:

  • 0-1024

<data>

String

Data bytes to be read

Notes

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

  • The +USORF AT command should not be used for a DTLS connection, that is when the connection has been configured using the +USOCO and the +USOSEC AT commands. For DTLS connections the +USOCO, +USOSEC, +USORD and +USOWR AT commands need to be used.

Set Listening Socket +USOLI

+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

Estimated maximum command response time

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

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.

Notes

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

HEX mode configuration +UDCONF=1

+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

-

+CME Error

Description

Enables/disables the HEX mode for +USOWR, +USOST, +USORD and +USORF AT commands.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<enable_hex_mode>

Number

Enables/disables the HEX mode for +USOWR, +USOST, +USORD and +USORF AT commands. Allowed values:

  • 0 (factory-programmed value): HEX mode disabled

  • 1: HEX mode enabled

Internal TCP/IP stack handling configuration+UDCONF=101

+UDCONF=101

Modules

LEXI-R10401D-00B LEXI-R10801D-00B

Attributes

Syntax

PIN required

Settings saved

Can be aborted

Response time

Error reference

full

No

NVM

No

-

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

Set

AT+UDCONF=101,<discard>

OK

AT+UDCONF=101,1

OK

Read

AT+UDCONF=101

+UDCONF: 101,<discard>

OK

+UDCONF: 101,1

OK

Defined values

ParameterTypeDescription

<discard>

Number

TCP packets discard option:

  • 0: partially acknowledges packets larger than the window size

  • 1 (factory-programmed value): discards packets not fitting window size.

Socket control +USOCTL

+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

-

+CME Error

Description

Allows interaction with the low level socket layer.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<socket>

Number

See <socket>.

<param_id>

Number

Control request identifier:

  • 0: query for socket type

  • 1: query for last socket error

  • 2: get the total amount of bytes sent from the socket

  • 3: get the total amount of bytes received by the socket

  • 4: query for remote peer IP address and port

  • 10: query for TCP socket status (only TCP sockets)

  • 11: query for TCP outgoing unacknowledged data (only TCP sockets)

  • 5-9, 12-99: RFU

Allowed values:

  • 0, 1, 2, 3, 4, 5-9, 10, 11, 12-99

<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:

  • 6 TCP socket

  • 17: UDP socket

If <param_id>=1, <param_val> can assume these values:

  • N: last socket error

If <param_id>=2, <param_val> can assume these values:

  • N: the total amount (in bytes) of sent (acknowledged + unacknowledged) data

If <param_id>=3, <param_val> can assume these values:

  • N: the total amount (in bytes) of received (read) data

If <param_id>=4, <param_val> can assume these values:

  • A string representing the remote peer IP address expressed in dotted decimal form

If <param_id>=10, <param_val> can assume these values:

  • 0: the socket is in INACTIVE status (it corresponds to CLOSED status defined in RFC793 "TCP Protocol Specification" [RFC793])

  • 1: the socket is in LISTEN status

  • 2: the socket is in SYN_SENT status

  • 3: the socket is in SYN_RCVD status

  • 4: the socket is in ESTABLISHED status

  • 5: the socket is in FIN_WAIT_1 status

  • 6: the socket is in FIN_WAIT_2 status

  • 7: the socket is in CLOSE_WAIT status

  • 8: the socket is in CLOSING status

  • 9: the socket is in LAST_ACK status

  • 10: the socket is in TIME_WAIT status

If <param_id>=11, <param_val> can assume these values:

  • N: the total amount of outgoing unacknowledged data

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

Iperf application+UIPERF

+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

-

+CME Error

Description

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.

Syntax

TypeSyntaxResponseExample

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

Defined values

ParameterTypeDescription

<action>

Number

Represents the IPERF services. Allowed values:

  • 0: terminate all IPERF services

  • 1: start IPERF client

  • 2: stop IPERF client

  • 3: start IPERF server

  • 4: start IPERF UDP NAT server

  • 5: stop IPERF server

<protocol>

Number

Represents the transport protocol:

  • 0 (default value): UDP

  • 1: TCP

<port>

Number

UDP/TCP port number. The range goes from 1 to 65535. The default value is 5001.

  • If <action> is 1 or 4, <port> is the destination server port number.

  • If <action> is 3, <port> is the local IPERF server port number.

<ipaddr>

String

IP address

  • if <action> is 1 or 4, the <ipaddr> paramter is mandatory, and indicates the destination server address.

  • If <action> is 3 and the test domain is ipv6 domain, the <ipaddr> parameter is mandatory. It must be the UE local IPV6 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:

  • 2: invalid input parameter

  • 3: socket error

  • 4: memory error