Big endian or Little endian on net?

后端 未结 3 462
粉色の甜心
粉色の甜心 2021-02-04 02:59

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 ?

3条回答
  •  暖寄归人
    2021-02-04 03:32

    "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.

提交回复
热议问题