O'Reilly logo

iOS and OS X Network Programming Cookbook by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Constructing a TCP packet with libnet

Using Transmission Control Protocol (TCP), a device sends packets to other devices on an IP network. TCP is designed to provide a reliable, ordered, and error-checked delivery of packets between applications. This does add additional overheads as compared to UDP, so applications that do not require reliability should use UDP instead.

When a device wants to communicate with another device using TCP, a three-way handshake must occur. The first device begins by sending a TCP packet with the SYN flag set. This is like saying, "Hi Joe. Can we talk?" The remote device is supposed to respond with a packet that has the SYN/ACK (synchronize/acknowledge) flags set, which is like Joe saying, "Sure, we can talk. What's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required