posted 19 years ago
I need some help about deciding how an application that transfers files from one computer to another tackles with the issue of byte order.
I am using NIO.
Say Alice is sending a file to Bob. Say Alice's computer is little endian, but Bob's is big endian. I have heard that "well mannered" applications should transmit in network order. The simplest solution would be that the application sending the files would transmit before the transmition a code representing the byte order of its machine. Then it sends the file content using that byte order. Bob's machine should only convert the data to its corresponding byte order if the received byte order does not match its own.
In this way we can avoid a conversion in the sending machine, and probably conversions in the receiving machines given that most of the computers are based on little endian processors.
Dou you think it is ok to contravene the network order rule?
TIA
SCJP2. Please Indent your code using UBB Code