HPlogo HP-UX IPv6 Porting Guide: HP-UX 11i v2 September 2004 > Chapter 3  Data Structure Changes

Generic Socket Address Structure

» 

Technical documentation

Complete book in PDF

 » Table of Contents

Header file

<netinet/in.h>
struct sockaddr_storage

The sockaddr_storage data structure simplifies writing portable code across multiple address families and platforms. This data structure provides the following flexibility and consistency.

  • One simple addition to the sockets API that can help application writers is the struct sockaddr_storage structure. The structure is large enough to accommodate all supported protocol-specific address structures.

  • sockaddr_storage aligns at an appropriate boundary so that pointers to it - can be cast as pointers to protocol specific address structures and used to access the fields of those structures without alignment problems.

© 2004 Hewlett-Packard Development Company, L.P.