Book Image

iOS and OS X Network Programming Cookbook

By : Jon Hoffman
Book Image

iOS and OS X Network Programming Cookbook

By: Jon Hoffman

Overview of this book

Table of Contents (15 chapters)
iOS and OS X Network Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


Libnet is a library that allows developers to construct and inject individual network packets. The libnet API hides most of the packet creation low-level details from the developer and allows the developer to quickly create and inject simple packets. Not only can libnet be used to create very powerful network security and monitoring tools, but it can also be used for malicious activities.

Note

While it is possible to compile libnet for the iPhone, if your app constructs custom packets and injects them into the network, Apple will probably reject your app. The code in this chapter is written and tested for OS X; it may or may not work on iOS.

When computers on an IP network wish to communicate, they exchange packets. These packets contain two types of information that are as follows:

  • Control information (header): The header provides information that the network needs to route the packet to the correct destination. This includes source and destination addresses, checksums, control...