Ping

The ping service requires the user to define and activate a connection profile before executing the +UPING AT command. Some products require additional commands to provide connectivity to the application.

If not specified the default CID (<cid>=1) is used. If not specified and the protocol type is IPv4v6, then the preferred protocol type is IPv4.

See +CGACT AT command for activating a PDP context.

Ping command +UPING

+UPING

Modules

All products

Attributes

Syntax

PIN required

Settings saved

Can be aborted

Response time

Error reference

full

No

No

No

-

+CME Error

PING Error

Description

The ping command is the common method to know if a remote host is reachable on the internet.

The ping functionality is based on the ICMP protocol (Internet Control Message Protocol), it is part of the Internet Protocol Suite as defined in RFC 792 [63]. ICMP messages are typically generated in response to errors in IP datagrams or for diagnostic / routing purposes.

The ping command sends an ICMP echo request to the remote host and waits for its ICMP echo reply. If the echo reply packet is not received, it might mean that the remote host is not reachable.

The ping command could be used also to measure e.g. the RTT (Round Trip Time, the time needed by a packet to go to the remote host and come back) and the TTL (Time To Live, it is a value to understand how many gateway a packet has gone through).

The set command allows the user to execute a ping command from the module to a remote peer. The results of the ping command execution is notified by means of these URCs:

  • +UUPING: it reports the +UPING command result when no error occurred.

  • +UUPINGER: it is raised if an error is occurred while processing the +UPING command. The URC reports the code of occurred error (see Ping error codes to get the meanings of the error result codes).

Some network operators may disallow ICMP packets traffic on their network, this means that the +UPING command may not work.

Some remote hosts might not reply to ICMP echo request for security reasons (e.g. firewall settings).

Some remote hosts might not reply to ICMP echo request if the data size of the echo request is too big.

If a remote peer does not reply to an ICMP echo request, it does not mean that for sure the peer cannot be reached in another way.

Syntax

TypeSyntaxResponseExample

Set

AT+UPING=<remote_host>[,<retry_num>,<p_size>,<timeout>,<ttl>[,<cid>[,<preferred_protocol_type>]]]

OK

AT+UPING="www.google.com"

OK

Test

AT+UPING=?

+UPING: "remote_host",(list of supported <retry_num>),(list of supported <p_size>),(list of supported <timeout>),(list of supported <ttl>,(list of supported <cid>),(list of supported <preferred_protocol_type>)

OK

+UPING: "remote_host",(1-64),(4-1460),(10-60000),(1-255)

OK

URC

+UUPING: <retry_num>,<p_size>,<remote_hostname>,<remote_ip>,<ttl>,<rtt>

+UUPING: 1,32,"www.l-google.com","72.14.234.104",55,768

URC

+UUPINGER: <error_code>

+UUPINGER: 12

Defined values

ParameterTypeDescription

<remote_host>

String

IP address (dotted decimal representation) or domain name of the remote host:

  • Maximum length: 128 characters

<retry_num>

Number

Indicates how many times iterate the ping command:

  • Range: 1-64

  • Default value: 4

<p_size>

Number

Size in bytes of the echo packet payload:

  • The range goes from 4 to 1460. The default value is 32.

<timeout>

Number

The maximum time in milliseconds to wait for an echo reply response:

  • Range: 10-60000

  • Default value: 5000

<ttl>

Number

The value of TTL to be set for the outgoing echo request packet. In the URC it provides the TTL value received in the incoming packet:

  • Range: 1-255

  • Default value: 32

<cid>

Number

PDP context identifier used for the PING communication. The allowed range is product specific, see <cid>. For more details on the default value of the parameter (where supported), see PING.

<preferred_protocol_type>

Number

Preferred protocol type to be specified when the <cid> protocol type is IPv4v6. Allowed values:

  • 0: IPv4

  • 1: IPv6

For more details on the default value of the parameter (where supported), see PING.

<remote_hostname>

String

String representing the domain name (if available) of the remote host. It this information is not available, it will be an empty string (i.e. "").

<remote_ip>

String

String representing the remote host IP address in dotted decimal form.

<rtt>

Number

RTT value, the time elapsed in milliseconds before receiving the echo reply response from the remote host.

<error_code>

Number

The error occurred while processing the +UPING command. See Ping error codes for the list of the allowed error result codes.

Notes

  • If the +UUPING URC reports <rtt> = -1 the timeout is elapsed (no response received).

  • If the first +UUPING URC reports <rtt> = -2 the TTL used in the ping request is too low.

  • Some network operators may return an ICMP time exceeded message when the remote host is not reachable. In these cases the first +UUPING URC reports <rtt> = -1 and the subsequent +UUPING URC report <rtt> = -2.

  • The <ttl> parameter is not supported however it is returned via the URC:

    • The set command expects an empty value, The "+CME ERROR: operation not supported" error result code (if +CMEE: 2) is returned while setting any value in the <ttl> parameter position.

    • Internally the TTL value=255 is used with every ping retry.

    • In the +UUPING URC output the <ttl> parameter is returned.

  • The "+CME ERROR: operation not allowed" error result code (if +CMEE: 2) is returned when the +UPING AT command is entered before a previous +UPING AT command is completed.

Last updated: Jan 13, 2025
Need help?Contact Support
Questions?Contact us