The Raw socket can be used to send and receive data from the L2 layer directly. To achieve this, a suitable socket protocol type needs to be sent out. we will use ETH_P_ARP for the ARP L2 protocol. The sample code only transmits a single ARP packet. An interested reader can add the receive code […]
Raw Socket Communication with Data Link Layer
In the previous examples, we used the TCP and UDP protocols and added the TCP/UDP headers in the sample application. The IP header was added by the linux kernel since we had not set the IP_HDRINCL flag via setsockopt API or used IPPROTO_RAW for the protocol in the socket API. However, Raw Sockets can be […]