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.

smwikipedia
  • 61,609
  • 92
  • 309
  • 482
  • 3
    **Type** could mean different things; a broadcast address is one type, a multicast address is another type, etc. – Gabe Feb 12 '11 at 07: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 Apr 27 '19 at 18:34

2 Answers2

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. They are merely synonyms, except that family looks like more specialized, well-suited for this purpose, whilst type is a too much general word.

apaderno
  • 28,547
  • 16
  • 75
  • 90
ulidtko
  • 14,740
  • 10
  • 56
  • 88
  • 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_ sockets register messages where XXX are non standard names. – Abhishek Sagar Apr 27 '16 at 08: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_` constant. – ulidtko Apr 28 '16 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   
Kiran Francis
  • 197
  • 1
  • 2
  • 3
    Where is the source for this? Seems like a pretty nice and extensive list. – sarangj Sep 17 '18 at 20:26
  • 3
    @sarangj You can find them in the [Address Family (7)](http://man7.org/linux/man-pages/man7/address_families.7.html) manpage. – yaobin Apr 27 '19 at 18:39