Big endian or Little endian on net?

后端 未结 3 446
粉色の甜心
粉色の甜心 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:58

    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.

提交回复
热议问题