PClient reference design ICMP ping
The pclient reference design implements the ICMP protocol to provide a simple ping implementation. The ICMP protocol is implemented on top of the RAW sockets supported by the oWL Pico API.
This example will show how to send an ICMP echo request to a remote host and print any replies.
First establish the link and set the IP address as described in
Commands:
$ linkup hdwireless
ok 0 (success)
link_cb: link:1
$ set_dhcp 1
addr_cb ip:192.168.2.101
Now use the ping command to send an ICMP echo request to a PC which is connected to the same network:
$ ping 192.168.2.100
ok 0 (success)
60 bytes from 192.168.2.100: icmp_seq=0
60 bytes from 192.168.2.100: icmp_seq=1
60 bytes from 192.168.2.100: icmp_seq=2
--- 192.168.2.100 ping statistics ---
3 packets transmitted, 3 received
For information on the implementation of the ICMP ping command, see the source code in the files
wlp_ping.c
and
wlp_ping.h
of the reference design.
Topic revision: r1 - 2011-02-04 - 12:28:04 -
AndersGrahn