Big endian, little-endian byte order and a deep understanding of the network

 

 1. Little-Endian (Little-Endian) Low byte is the low address discharge at the end of the start address of the memory value, high emissions high byte address terminal memory. 
2. big endian (Big-Endian) is discharged in the high byte of memory, i.e., the low end address of the starting address value and the low byte address discharge in the high-end memory.

 

Network byte order defined: The first byte received is viewed as a high, which requires the sender sends the first byte should be high. And when the transmitting side transmits data, the first byte sent is the number in the memory address corresponding to the start byte. Shows multiple byte value before transmission, it should be stored in a big endian value in memory.
It said network byte order is big endian.

 

Network byte order
  on a data transmission network is a stream of bytes, for a multi-byte value during the network transmission time, which byte is transmitted first? That is, when the receiver receives the first byte of the when will this byte as the high byte or low byte processing, is a more significant problem;
  UDP / TCP / IP protocol provides that: the received first byte as the high byte look at this It requires the sender sends the first byte is the high byte; and when the transmitting side transmits data, the first byte sent is the starting byte address corresponding to the value in memory, i.e. said address corresponding to the start byte of the value in the first memory is a high byte to be transmitted (i.e.: high byte stored at the lower address); Thus, a multi-byte value in the transmission before, in memory because of the big endian is stored;
  Therefore, network byte order is big endian;
  in practice, when transmitted on different hosts of two storage required by bytes order transfer function

The size of the common end

General operating system are little-endian mode; and communication protocols are big-endian mode; and platform-independent java, the default is the big endian mode
common end cpu size:
big-endian: PowerPC, IBM, Sun
small end: x86
ARM can either work in big-endian mode, it can also work in little-endian mode

Guess you like

Origin www.cnblogs.com/endian11/p/11888940.html