Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
NetworkByteOrder
Edit
PageHistory
Diff
Info
LikePages
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. 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.
2 pages link to
NetworkByteOrder
:
NetworkProgrammingOld
Endianness