Network Programming: Socket Function: Vs Protocol Family Address Family

I just started with network programming. When viewing a socket function, some use PF_INET, while others use AF_INET. At wikipedia, he says that such a design was used to use different address families in different protocol families. Are there any protocol families today that support multiple address types?

I also ran into this error when I was looking for the Vs Protocol family of address families:

Address family not supported by protocol family 

Does this mean that there are protocols that support multiple address families?

I came across this expression

 you shouldn't necessarily expect to be able to use NS addresses with ARPA Internet protocols 

What are NS addresses?

Thanks.

+7
source share
1 answer

The Windows documentation for socket says the address family is the first argument; the man page on my linux box says it should be a protocol family. The Linux version looks a little more correct from the platform point of view - agnostic - theoretically, a socket has a protocol family, and addresses have address families, and two must be compatible.

However, in practice, the PF_ and AF_ for embedded protocols have the same values ​​(both on Linux and Windows). I imagine a similar story for most operating systems, since all common protocol families have the same address family. (You would assume that IP will have two, but no. There are separate protocol families for IPv4 and IPv6.) This (along with the relatively weak type C) allows them to be used interchangeably.

Please note that there is no guarantee that this applies to all operating systems, or to protocols supported by a third-party driver, etc. In these cases, you should read the documentation for your specific platform.

As far as the "NS addresses" are concerned, as far as I can tell, they are part of the prehistoric Xerox Network Systems Protocol (a family sorting protocol such as TCP / IP, but excellent and incompatible and not used by modern PCs). You will not see them in use if you do not work with archaic systems; why this is preserved as an example, outside of me.

+3
source

All Articles