Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is network-byte-order defined to be big-endian? [closed]

As written in the heading, my question is, why does TCP/IP use big endian encoding when transmitting data and not the alternative little-endian scheme?

like image 649
Neji Avatar asked Nov 22 '12 14:11

Neji


People also ask

Is network byte order big-endian?

The TCP/IP standard network byte order is big-endian. In order to participate in a TCP/IP network, little-endian systems usually bear the burden of conversion to network byte order.

Why are network protocols big-endian?

Big-endian CPUs order bytes within words so that the most significant byte is stored at the lowest byte address; little-endian CPUs, including IA-32 processors, use the opposite byte placement. When communicating across a network, it is possible that two machines may use different byte orderings.

Why is big-endian called big-endian?

Big-endian is an order in which the "big end" (most significant value in the sequence) is stored first, at the lowest storage address. Little-endian is an order in which the "little end" (least significant value in the sequence) is stored first.

Why is byte order important in networking?

The network byte order is defined to always be big-endian, which may differ from the host byte order on a particular machine. Using network byte ordering for data exchanged between hosts allows hosts using different architectures to exchange address information without confusion because of byte ordering.


1 Answers

RFC1700 stated it must be so. (and defined network byte order as big-endian).

The convention in the documentation of Internet Protocols is to express numbers in decimal and to picture data in "big-endian" order [COHEN]. That is, fields are described left to right, with the most significant octet on the left and the least significant octet on the right.

The reference they make is to

On Holy Wars and a Plea for Peace  Cohen, D.  Computer 

The abstract can be found at IEN-137 or on this IEEE page.


Summary:

Which way is chosen does not make too much difference. It is more important to agree upon an order than which order is agreed upon.

It concludes that both big-endian and little-endian schemes could've been possible. There is no better/worse scheme, and either can be used in place of the other as long as it is consistent all across the system/protocol.

like image 69
Anirudh Ramanathan Avatar answered Sep 22 '22 16:09

Anirudh Ramanathan