In standard sockets, the payload to be transmitted is encapsulated according to the chosen transport layer protocol (e.g. TCP, UDP). In contrast, raw sockets usually receive raw packets including the header. When transmitting packets, the automatic addition of a header may be a configurable option of the socket.
Raw sockets are used in security related applications like nmap, packet-sniffer. One possible use case for raw sockets is the implementation of new transport-layer protocols in user space. Raw sockets are typically available in network equipment, and used for routing protocols such as the Internet Group Management Protocol (IGMP) and Open Shortest Path First (OSPF), and in the Internet Control Message Protocol (ICMP, best known for the ping suboperation).
||This article has been nominated to be checked for its neutrality. (February 2015)|
Most socket application programming interfaces (APIs), especially those based on Berkeley sockets, support raw sockets. When Microsoft released Windows XP in 2001 with raw socket support implemented in the Winsock interface, some pundits, the most extravagant of which was Steve Gibson, criticized Microsoft for what Gibson described as "spelling catastrophe for the integrity of the Internet", asserting that raw sockets would be widely used by hackers to perform TCP reset attacks. The internet did not collapse, but three years after the Windows XP release, Microsoft limited Winsock's raw socket support in a non-removable hotfix and offered no further support or workarounds for applications that used them.
- "raw(7): IPv4 raw sockets - Linux man page". die.net.
- "Raw IP Networking FAQ". faqs.org.
- Seth Fogie for InformIT Jun 21, 2002 Raw Sockets Revisited: What Happened to the End of the Internet?
- Ian Griffiths for IanG on Tap. 12 August, 2004. Raw Sockets Gone in XP SP2
- Net::RawIP; module for Perl applications. Created by Sergey Kolychev.
- Network Programming for Microsoft Windows (ISBN 0-7356-1579-9)
- A little more info on raw sockets and Windows XP SP2 - Michael Howard's Web Log an indication of what's actually allowed on Windows.
- SOCK_RAW Demystified: article describing inner workings of Raw Sockets
- C language examples of Linux raw sockets for IPv4 and IPv6 - David Buchan's C language examples of IPv4 and IPv6 raw sockets for Linux.