AF_INET or PF_INET?
Myrdos

Which one is considered to be better style? I had a look in the man page for socket, and it showed PF_INET. However, it later refers to AF_INET further down the page. A shocking lack of consistency...

I searched the web with no good results, some people use one, some people use the other. One thing I noticed: most people who use PF_INET place it in the socket() parameter, but use AF_INET elsewhere in their program. Any reason for this, or does it even matter?

CGamesPlay

AF_INET = Address Format, Internet = IP Addresses
PF_INET = Packet Format, Internet = IP, TCP/IP or UDP/IP

[edit]

According to the link, it's:

AF_INET = Address Family, Internet = IP Addresses
PF_INET = Protocol Family, Internet = IP, TCP/IP or UDP/IP

You should read the comments ::)

Myrdos

O .... K.

I think I get it now. We want to use protocol families for sockets, and address families for addresses. Makes sense. It's just a happy coincidence that they're both equal to two, and are therefore interchangeable. A coincidence that I should not rely on.

I did read the comments, but somehow their meaning escaped me...:-[

Thread #563350. Printed from Allegro.cc