Constructing a UDP packet with libnet

The User Datagram Protocol (UDP) sends datagrams to other hosts on an IP network without any prior handshaking to set up the communication channel between the devices. A datagram is just a packet (like an ICMP or TCP packet), except that the delivery, arrival time, and sequence are not guaranteed. The UDP protocol is considered to be an unreliable protocol because there is no guarantee of delivery.

The minimalist approach of UDP makes it ideal for real-time applications, such as Voice over IP, online games and streaming media, where dropping of packets is preferred over waiting for delayed packets. If guarantee of delivery is needed so that packets are not dropped, applications should use TCP or SCTP instead ...

Get iOS and OS X Network Programming Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.