Share via


SOCKADDR_INET (Compact 2013)

3/26/2014

This union contains an IPv4, an IPv6 address, or an address family.

Syntax

typedef union _SOCKADDR_INET {
  SOCKADDR_IN Ipv4;
  SOCKADDR_IN6 Ipv6;
  ADDRESS_FAMILY si_family;
} SOCKADDR_INET,
  *PSOCKADDR_INET;

Members

  • Ipv4
    An IPv4 address represented as a SOCKADDR_IN structure that contains the address family and the IPv4 address. The address family is in host byte order and the IPv4 address is in network byte order.

    The header file organization has changed and the SOCKADDR_IN structure is defined in the Ws2def.h header file. Note that the Ws2def.h header file is automatically included in Winsock2.h, and should never be used directly.

  • Ipv6
    An IPv6 address represented as a SOCKADDR_IN6 structure that contains the address family and the IPv6 address. The address family is in host byte order and the IPv6 address is in network byte order.

    The header file organization has changed and the SOCKADDR_IN6 structure is defined in the Ws2def.h header file. Note that the Ws2def.h header file is automatically included in Winsock2.h, and should never be used directly.

  • si_family
    The address family.

    Possible values for the address family are listed in the Ws2def.h header file. Note that the values for the AF_ address family and PF_ protocol family constants are identical (for example, AF_INET and PF_INET), so either constant can be used. The Ws2def.h header file is automatically included in Winsock2.h, and should never be used directly.

    The values currently supported are AF_INET, AF_INET6, and AF_UNSPEC.

    Value

    Meaning

    AF_UNSPEC

    0

    The address family is unspecified. When this parameter is specified, the SOCKADDR_INET union can represent either the IPv4 or IPv6 address family.

    AF_INET

    2

    The Internet Protocol version 4 (IPv4) address family.

    AF_INET6

    23

    The Internet Protocol version 6 (IPv6) address family.

Remarks

The SOCKADDR_INET union is a convenience structure for accessing an IPv4 address, an IPv6 address, or the IP address family without having to cast the sockaddr structure.

The SOCKADDR_INET union is the data type of the Prefix member in the IP_ADDRESS_PREFIX structure

Note that the Ws2ipdef.h header file is automatically included in Ws2tcpip.h header file, and should never be used directly.

See Also

Reference

IP Helper Structures
IP_ADDRESS_PREFIX
sockaddr