28

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.

2
  • 3
    Type could mean different things; a broadcast address is one type, a multicast address is another type, etc.
    – Gabe
    Commented Feb 12, 2011 at 7:37
  • I agree. I am also confused by the choice of words sometimes, and AF was one of them. I guess there might be some historical reasons but I don't know. Anyway, in such situations, I'll try to figure out so they are aligned with my understanding conceptually. But if I can't, I'll just accept the terminology.
    – yaobin
    Commented Apr 27, 2019 at 18:34

2 Answers 2

34

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 really need to distinguish between family and type here. These are merely synonyms; except that family looks more specialized, well-suited for this purpose, whilst type is much overloaded, way too general word.

Ultimately, it's a convention. There's just so much literature using "address family" that it's well-established terminology, by decades if not human lifetimes.

2
  • So, when should one plan to add/create a new address family type(AF_) ? Any criteria for this ? I work in networking industry, and see AF_<XXX> sockets register messages where XXX are non standard names. Commented Apr 27, 2016 at 8:38
  • @Abnishek network addressing is OSI Level 3 function; so whenever you invent/introduce/experiment with a new L3 protocol (which basically means: any IP alternative) — you'll also need a new address family and a new AF_<XXX> constant.
    – ulidtko
    Commented Apr 28, 2016 at 11:50
18
  Name                   Purpose                 
   AF_UNIX, AF_LOCAL      Local communication              
   AF_INET                IPv4 Internet protocols        
   AF_INET6               IPv6 Internet protocols
   AF_IPX                 IPX - Novell protocols
   AF_NETLINK             Kernel user interface device    
   AF_X25                 ITU-T X.25 / ISO-8208 protocol 
   AF_AX25                Amateur radio AX.25 protocol
   AF_ATMPVC              Access to raw ATM PVCs
   AF_APPLETALK           Appletalk                      
   AF_PACKET              Low level packet interface   
2
  • 3
    Where is the source for this? Seems like a pretty nice and extensive list.
    – sarangj
    Commented Sep 17, 2018 at 20:26
  • 3
    @sarangj You can find them in the Address Family (7) manpage.
    – yaobin
    Commented Apr 27, 2019 at 18:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.