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

Resolving names to addresses with libnet

In this recipe, we learn how to resolve DNS names (such as www.packtpub.com) 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 ...

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