Before we get into any details I think it’s worth a discussion what exactly is the difference between ‘Data’ and ‘Data representation’ in computer. When you see the representation ‘10′ you understand that it represent count ten. When you see the roman letter ‘X’ then also you interpret it as count 10.So ‘10′ and ‘X’ are data representation of same thing - count 10.In the world of computers also they have their own data representation, i.e. binary format. The count ten can be represented using 1 byte-00001010,which the computer recognizes as count 10 every time it sees this bit pattern.
There is no problem when reading a single byte because all computers read the bit patterns the same way. But not all the data representation can be done using 1 byte. Take for example a short variable form C/C++. It requires 2 bytes to represent one short variable.
Now the problems starts - when you read multi-byte data, where does the biggest byte appear?
•Big endian machine: Stores data big-end first. When looking at multiple bytes, the first byte (lowest address) is the biggest.
•Little endian machine: Stores data little-end first. When looking at multiple bytes, the first byte is smallest.
Like the decimal ‘10′ and roman ‘X’ represent the same thing, the Big and Small endian representations represent the same data but with different bit patterns and this creates problem when transmitting data between machines which has different byte-sex.
Let’s illustrate it with an example where we try to store the word UNIX in two consecutive short variables
short *s; // pointer to set shorts
s = 0; // point to location 0
*s = UN; // store first short: U * 256 + N
s = 2; // point to next location
*s = IX; // store second short: I * 256 + X
On a big endian machine we see
Byte: U N I X
Location: 0 1 2 3
On a little-endian machine we would see:
Byte: N U X I
Location: 0 1 2 3
In the second case even though the bytes are stored “backwards” in memory, the little-endian machine knows it is little endian, and interprets them correctly when reading the values. But what happens when u pass a data from little-endian machine to big endian machine. The big endian machine reads UNIX as NUXI and that may be the beginning of a big problem .And this exactly is called the NUXI problem.
And the solutions:-
•The easiest approach is to agree to a common format for sending data over the network. The standard network order is actually big-endian.
•The other approach is to include a Byte Order Mark (BOM) before every piece of data which is sent across the network



