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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.