4 ms·
> Most network protocols and formats until recently have been big endian (Network Byte Order). This misses the point of the original reason for this - big endi
by rkangel 5y ago
> Most network protocols and formats until recently have been big endian (Network Byte Order).
This misses the point of the original reason for this - big endian is more convenient if you're reading the value into a shift register. You don't need to know in advance how big the value is because you just shift the contents left each time you get a new byte and you end up with the appropriate 0 padded value.
Basically for a period of history, big endian was easier to implement for comms and little endian for processors. The big endian comms reasons have generally died out while the processor ones remain.
Network byte order (big endian in communication) is a very strong convention though. If you define a network protocol and use little endian then I will be very sad.
- AnIdiotOnTheNet 5y agoWhy? If I'm designing my own protocol I could use middle-endian EBCDIC encoded octal and it shouldn't make any difference to anything else.
- rkangel 5y agoAre you building every implementation of the protocol? Or are you publishing a communications standard for people to implement? If I'm building a network stack and at every layer I'm pulling values out of the header in network byte order, except in one special case where I have to pull them the other way (for no good reason) then that's the protocol author's fault. If there is a good reason for using middle-Endian EBCDIC (compatibility or technical) then fine. If not, then please use the thing that's the strong convention and therefore simplest to work with.
- dahfizz 5y agoAs long as you don't want anyone to adopt the protocol, then go ahead.