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()>
Meaning, AF_INET refers to addresses from the internet, IP addresses specifically. PF_INET refers to anything in the protocol, usually sockets/ports.
Consider reading the man pages for socket(2) and bind(2). For the sin_addr field, just do something like the following to set it:
struct sockaddr_in addr;
inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr);