Sockets Address Data Structures
There are a number of data structures used to represent network addresses, along with a number of functions for converting addresses between different formats.
The fundamental data structure in the sockets API is struct sockaddr:
struct sockaddr { uint8_t sa_len; sa_family_t sa_family; char sa_data[14]; };
struct sockaddr acts like an abstract base class in object-oriented languages. It defines two fields that are common amongst all of the different address types. By examining these fields you can see how large the address structure is by looking at sa_len, and you can see what kind of address it ...
Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide 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.