Debugging and Testing Network Extensions

Apart from the general techniques discussed in Chapter 16, “Debugging and Profiling,” Mac OS X comes with some tools that allow debugging of network issues, the most notable of which are perhaps the command line tools tcpdump and netcat. The former utilizes the libpcap library, which again is built on top of the Berkeley Packet Filter (BPF) infrastructure, which is built into the kernel network stack. BPF can plug into each network interface and install hooks, which allow incoming and outgoing packets to be diverted to a character device file (/dev/bpfX) and can thereby be analyzed by tools such as tcpdump. The tcpdump utility allows you to view the packet flow live, or to capture it to a file for later ...

Get OS X and iOS Kernel Programming 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.