Use AF_INET
if you want to communicate using the Internet protocols: TCP or UDP. This is by far the most common choice, and almost certainly what you want.
Use PF_PACKET
if you want to send and receive messages at the most basic level below the level of the Internet protocol, for example, because you yourself implement the protocol. To use PF_PACKET
your process must run as root (or with special features). This is a very advanced option. If you need to ask this question, you want AF_INET
, not PF_PACKET
.
source share