ICMP Echo-Reply (Ping)
Overview
Ping is a useful network utility used to test if a remote host is reachable on the IP network. It measures the round-trip time for messages sent from the source host to a destination target that are echoed back to the source.
Ping operates by sending Internet Control Message Protocol (ICMP) echo request packets to the target host and waiting for an ICMP echo reply.
This example implements a simple ping command line util based on the cli component.
Notes: Currently this example only supports IPv4.
Requirements
A working AP is required.
A serial port tool supporting shell is required.
Building and flashing
Example Location: examples/network/icmp_echo
compile, burn, and more, see: get started
Running result
Successfully running will output the following logs
===================================================
| Steps to test icmp echo |
| |
| 1. Print 'help' to gain overview of commands |
| 2. Configure device to station or softap |
| 3. Setup WiFi connection |
| 4. Run ping to test icmp echo |
| |
===================================================
W800S2:
W800S2: ping
Usage
ping [options] <destination>
Options:
<destination> dns name or ip address
-c <count> stop after <count> replies
-i <interval> milliseconds between sending each packet
-s <size> use <size> as number of data bytes to be sent
-t <ttl> define time to live
-q <tos> define type of service
-w <timeout> milliseconds to wait for response
-h print help and exit
W800S2:
W800S2: ping www.baidu.com -c 5
32 bytes from 183.2.172.42 icmp_seq=0 ttl=52 time=42 ms
32 bytes from 183.2.172.42 icmp_seq=1 ttl=52 time=44 ms
32 bytes from 183.2.172.42 icmp_seq=2 ttl=52 time=38 ms
32 bytes from 183.2.172.42 icmp_seq=3 ttl=52 time=40 ms
32 bytes from 183.2.172.42 icmp_seq=4 ttl=52 time=38 ms
--- 183.2.172.42 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 202ms
W800S2: