Raw sockets provide three features not provided by normal TCP and UDP sockets:
Raw sockets let us read and write ICMPv4, IGMPv4, and ICMPv6 packets. The
ping program, for example, sends ICMP echo requests and receives ICMP echo replies. (We will develop our own version of the
ping program in Section 28.5.) The multicast routing daemon,
mrouted, sends and receives IGMPv4 packets.
This capability also allows applications that are built using ICMP or IGMP to be handled entirely as user processes, instead of putting more code into the kernel. The router discovery daemon (
in. rdisc under Solaris 2.x; Appendix F of TCPv1 describes how to obtain the source code for a publicly available version), for example, is built ...