• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Byte order and file transference.

 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
leon fan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you need do any process relative byte order especially for many binary files.

If you want to deal text file, it's better to put byte order information into that text file.
 
leon fan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If that text is unicode.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic