In what byte order does data transfer occur on net? Is it Little Endian or big endian? How is it converted to the respective byte order once the data reaches the host ?
"Network byte order" is Big Endian, and protocols such as TCP use this for integer fields (e.g. port numbers). Functions such as htons and ntohs can be used to do conversion.
The data itself doesn't have any endianness it's entirely application defined, unless you're using a Presentation Layer such as XDR.
Its transferred in whatever order you send it.
Traditionally, internet protocols use big endian, because the machines doing most of the communication were big endian.
However, if you define your own structures to send across the net, there is no need to follow that convention.
With C programming, typically, one often uses the htons or ntohs macros to do the conversion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With