Raw Sockets

The raw socket interface provides direct access to lower layer protocols, such as the Internet Protocol (IP) and Internet Control Message Protocol (ICMP or ICMPv6). You can use raw sockets to test new protocol implementations. You can extend the socket interface; you can define new socket types to provide additional services. Because they isolate you from the communication functions of the different protocol layers, socket interfaces are largely independent of the underlying network. In the AF_INET address family, stream sockets interface to TCP, datagram sockets interface to UDP, and raw sockets interface to ICMP and IP. In the AF_INET6 address family, stream sockets interface to TCP, datagram sockets interface to UDP, and raw sockets interface to ICMPv6 and IP.