Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Tuesday, April 15, 2008

Q & A on Network Standard Byte Order and User Data.

Q: I can understand the neccessary of the internet standard for byte order. But, why the user data field in packet is exempt from the standard?

If i communicate between a Little Endian machine and a Big Endian machine, the data would be misunderstand or my program must deal with the byte order, which means that my program is related to the unique machine, right?

A: You are correct in asserting that all data must be translated. If an application running on a Little Endian computer merely transfers a copy of the bits of an integer to an application running on a Big endian computer, the receiver will interpret the value of the bits differently, resulting in an error.

However, it does not make sense for network protocol to require translations because only the application programmer understands the data being sent across the network. If an application uses non-numeric data or has a reason to specify a particular representation, the network protocols should not interfere.

As a result, application programmers have complete freedom to choose a data representation, but also have the responsibility to handle any byte-order conversions or their clients and servers will not work correctly when communicating between two computers that have different native byte orders.

No comments:

Archives