Penguin
Blame: NetworkByteOrder
EditPageHistoryDiffInfoLikePages
Annotated edit history of NetworkByteOrder version 2, including all changes. View license author blame.
Rev Author # Line
2 AristotlePagaltzis 1 The [Endianness] that should be assumed for data sent over a network. Most NetworkByteOrder~s, notably including that of [TCP/IP], are BigEndian. Protocols designed at MicrosoftCorporation, being [x86]-centric as it is, tend to be LittleEndian.
2
3 Libc provides functions called htonl(3) (host to network long (32 bits)), htons(3) (host to network short (16 bits)), ntohl(3) (network to host long (32bits)), and ntohs(3) (network to host short (16bits)) to convert between host byte order and NetworkByteOrder. By using these functions, the code will Do The Right Thing regardless of whether it is being compiled for a big- or little-endian machine.