The address structure depends on the IP addressing family. An IPv4
socket address in an IP addressing family is comprised of the following
four fields:
- Address family
- Set to AF_INET in C, or to a decimal 2 in other languages.
- Port
- Port used by the application, in network byte order (which is
explained in TCP/IP network byte ordering convention).
- IPv4 address
- The IPv4 address of the network interface used by the application.
It is also in network byte order.
- Character array
- Should always be set to all zeros.
An IPv6 socket address in an IP addressing family is comprised
of the following five fields:
- Address family
- Set to AF_INET6 in C or to a decimal 19 in other languages.
- Port
- Port used by the application, in network byte order (which is
explained in TCP/IP network byte ordering convention).
- Flow Information
- Four bytes in binary format indicating traffic class and flow
label. This field is currently not implemented.
- IPv6 address
- The IPv6 address of the network interface used by the application.
It is in network byte order.
- Scope ID
- Used to specify link scope for an IPv6 address as a interface
index. If specified, and the destination is not link local, the socket
call fails.