why do internet protocols use network byte order

1

Why do internet protocols use a network byte order? Suppose that the IP address of

139.156.32.45 is stored in memory starting from address A in network byte order, how

does it appear? And how does that bit stream appear when the address is transmitted in the

network?

user3702140

Posted 2014-06-03T09:27:07.960

Reputation: 11

Question was closed 2014-06-06T14:12:57.803

Answers

3

Internet protocol (IP) uses 'network byte order' (big-endian) because it was agreed that it would do so (see RFC 1700. IP 139.156.32.45 in big-endian binary is 10001011.10011100.00100000.00101101 (. added for legibility), and this is how it would be transferred over the network.

Depending on your architecture this address can be stored in a big-endian or little-endian format. If you are using X86 architecture (little endian), the bits (per byte) would be reverted, so they would end up being stored as 11010001.00111001.00000100.10110100. In a SPARC CPU, which uses big-endianness the bits would be stored like the IP protocol uses them.

mtak

Posted 2014-06-03T09:27:07.960

Reputation: 11 805

There's no instruction that would reveal bit order, so your statement about it being "reversed" doesn't make any sense. – Ruslan – 2019-08-06T06:36:11.707

1If I'm not mistaken, the bits per byte remain unchanged but the order of the bytes in a word change. In little endian, the address would be 00101101.00100000.10011100.10001011 – user2313067 – 2014-06-03T14:43:01.983