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

Chapter 4. Using Libpcap

In this chapter, we will cover:

  • Adding libpcap to your project
  • Retrieving network device information
  • Capturing packets
  • Decoding Ethernet headers
  • Decoding IP headers
  • Decoding ARP headers
  • Decoding TCP headers
  • Decoding UDP headers
  • Decoding ICMP headers
  • Filtering packets
  • Saving a capture file
  • Creating a simple port scanner using libnet and libpcap together

Introduction

In the previous chapter, we discussed libnet, which is a library for constructing and injecting individual network packets. Being able to create and inject packets into the network is a very powerful feature, but to really make it useful, we need to be able to read the packets that come back. This is where libpcap comes in.

Note

While it is possible to compile libpcap for iOS ...

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