Extended Byte-Order Conversion Routines

Windows Sockets 2 does not assume that the network byte order for all protocols is the same. A set of conversion routines is supplied for converting 16-bit and 32-bit quantities to and from network byte order. These routines take as an input parameter the socket handle that has a WSAPROTOCOL_INFO structure associated with it. The NetworkByteOrder member of the WSAPROTOCOL_INFO structure specifies the desired network byte order (currently either big-endian or little-endian).

htonl

htons

ntohl

ntohs

Porting Socket Applications to Winsock

Winsock Programming Considerations

WSAHtonl

WSAHtons

WSANtohl

WSANtohs

WSAPROTOCOL_INFO