Retrieving network address information

Most applications that communicate over a network will eventually need to know the information from the available network interfaces of the device they are running on. This recipe will show you how to retrieve the network addresses for all the active network interfaces on the device.

This recipe will use the NSHost class to retrieve a list of addresses on your local device. While NSHost is available on iOS, it is a private (undocumented) class. It is also noted on a number of forum posts that Apple has rejected iOS apps for using NSHost. If you need to retrieve network address information within an iOS application, it is recommended that you use the Retrieving network address information recipe from Chapter ...

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