Understanding struct sockaddr

The format and size of the address is usually protocol specific.

sockaddr is used as the base of a set of address structures that act like a discriminated union, see the Beej guide to networking. You generally look at the sa_family and then cast to the appropriate address family’s specific address structure.

TCP and UDP do not have addresses specific to them as such, rather the IP level has different sizes of address for IPv4 and IPv6.

See also:

  • http://en.wikipedia.org/wiki/AF_INET
  • http://msdn.microsoft.com/en-us/library/ms740496(v=vs.85).aspx
  • http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xml

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)