I noticed this discrepancy in the winsock tutorial

Iczelion says:

af == Address format which at the current time there is only one: PF_INET
type == type of the socket you want to create, stream or datagram one. If you want a stream socket, use SOCK_STREAM else use SOCK_DGRAM
protocol == if the af param is AF_UNSPEC (unspecified), you must specify the protocol here. However, since we always use PF_INET, you can use 0.

Which is backed up by what is said on the win32 help files

af - An address format specification. The only format currently supported is PF_INET, which is the ARPA Internet address format.

Then in Iczelion's code snippet he shows

invoke socket,AF_INET,SOCK_STREAM,0    ; Create a stream socket for internet use
    mov sock,eax

Also the Madwizard winsock tutorial uses AF_INET

af - The address family to use. Use AF_INET to use the address family of TCP & UDP.

And in his code snippet

    cmp    eax, INVALID_SOCKET
    jne    _socket_created

So I am rightly confused

MSoft say PF_INET
Iczelion says PF_INET then uses AF_INET
Madwizard says AF_INET

Which should I be using and what's the difference?

Posted on 2005-10-04 06:09:52 by dicky96
PF_INET equal to AF_INET.
AF is acronym for Address Families and it's sometimes referred as PF (Protocol Families)
Posted on 2005-10-04 07:45:41 by arafel