What is the difference between AF_INET and PF_INET in socket programming?

前端 未结 7 811
一向
一向 2020-11-30 16:13

What is the difference between AF_INET and PF_INET in socket programming?

I\'m confused between using AF_INET and PF_INET in socket() and bind()

相关标签:
7条回答
  • 2020-11-30 17:10

    In fact, AF_ and PF_ are the same thing. There are some words on Wikipedia will clear your confusion

    The original design concept of the socket interface distinguished between protocol types (families) and the specific address types that each may use. It was envisioned that a protocol family may have several address types. Address types were defined by additional symbolic constants, using the prefix AF_ instead of PF_. The AF_-identifiers are intended for all data structures that specifically deal with the address type and not the protocol family. However, this concept of separation of protocol and address type has not found implementation support and the AF_-constants were simply defined by the corresponding protocol identifier, rendering the distinction between AF_ versus PF_ constants a technical argument of no significant practical consequence. Indeed, much confusion exists in the proper usage of both forms.

    0 讨论(0)
提交回复
热议问题