Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This structure stores socket address information. Because this structure is large enough to store IPv4 or IPv6 address information, its use promotes protocol-family and protocol-version independence, and simplifies cross-platform development. Use this structure in place of the sockaddrstructure.
Syntax
typedef struct sockaddr_storage { short ss_family; char __ss_pad1[_SS_PAD1SIZE]; __int64 __ss_align; char __ss_pad2[_SS_PAD2SIZE]; } SOCKADDR_STORAGE, *PSOCKADDR_STORAGE; |
Members
- ss_family
-
Address family of the socket, such as AF_INET.
- __ ss_pad1
-
Reserved. Defined as a 48-bit pad that ensures this structure achieves 64-bit alignment.
- __ ss_ align
-
Reserved. Used by the compiler to align the structure.
- __ ss_pad2
-
Reserved. Used by the compiler to align the structure.
Remarks
Application developers should use only the ss_familymember of this structure. The remaining three members ensure the structure is padded appropriately to achieve 64-bit alignment. Such alignment enables protocol-specific socket address data structures to access fields within a SOCKADDR_STORAGEstructure without alignment problems. Because of its padding, the structure is 128 bytes in length.
The member field of this structure is isomorphic with the sockaddrstructure to enable simplified transition from sockaddrto SOCKADDR_STORAGE.
Requirements
Header | winsock2.h |
Windows Embedded CE | Windows CE .NET 4.1 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |