参见CSAPP
For most application programmers, the byte orderings used by their machines are totally invisible; programs compiled for either class of machine give identical results. At times, however, byte ordering becomes an issue. The first is when binary data are communicated over a network between different machines. A common problem is for data produced by a little-endian machine to be sent to a big-endian machine, or vice versa, leading to the bytes within the words being in reverse order for the receiving program. To avoid such problems, code written for networking applications must follow established conventions for byte ordering to make sure the sending machine converts its internal representation to the network standard, while the receiving machine converts the network standard to its internal representation.
【 在 xiaguagua 的大作中提到: 】
: 大拿,我有个疑问 假如一个是大端机器,一个是小端,就算是变成同样的JSON格式,他们的二进制也是不一样的吧?大端的JSON 传到小端不是乱码吗?序列化是如何处理这种硬件差异的?
: 来自 ddrk专用