Resolving names to addresses with libnet

In this recipe, we learn how to resolve DNS names (such as to IP addresses using libnet. This recipe will introduce libnet functions that will resolve the address from the DNS name and display the address. It will also introduce the libnet_init() and libnet_destroy() functions.

The libnet_init() function initializes and returns a libnet context. This context is the center of everything that libnet does. A libnet context should be initialized prior to using any of the libnet functions. The context should also be destroyed, using the libnet_destroy() function, once it is no longer needed.

Getting ready

Prior to running the examples in the chapter, we will need to download and install libnet ...

Get iOS and OS X Network Programming Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.