socketsnetwork-programming

What is Address Family?


When I read about socket programming, I get to know that AF_ stands for Address Family. But literally, a family should have many members. So, what are the members of, say, AF_INET address family?

In my opinion, I think it would be more appropriate to say Address Type than Addresss Family. Also this applies to PF (Protocol Family).

Thanks.


Solution

  • Members of AF_INET address family are IPv4 addresses.

    Members of AF_INET6 address family are IPv6 addresses.

    Members of AF_UNIX address family are names of Unix domain sockets (/var/run/mysqld/mysqld.sock is an example).

    Members of AF_IPX address family are IPX addresses, and so on.

    I don't think you want to make a hard distinction between family and type here. In context, these are merely synonyms; except that family is more specialized, well-suited for this purpose, whilst type is much overloaded, way too general word.

    And ultimately, terminology matters as a convention. What establishes "address family" is not (in our view today, perhaps) the best-possible sense that inventors gave it 50 years ago. What establishes "address family" is 50 years of consistent usage in literature and source code. It's unwise to try to redefine a term used consistently across decades if not human lifetimes.