Sunday, December 23, 2012

Writing endian-independent code in C


I came across this article after reading that 0MQ considers your message to be a binary blob so if for instance you are exchanging integers over the network between different endian machines you must make sure to convert back and forth.

I think the simple solution is to always convert integers to network byte order when leaving a machine. Then on the receiving end you convert the host byte order. Problem Solved.

http://www.ibm.com/developerworks/aix/library/au-endianc/index.html?ca=drs-

No comments:

Post a Comment