This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
The cpu and hence the kernel should be little-endian. I think what you are seeing is due to some eccentricity of the networking layer. I'll check if someone can shed more light on this.
Regards,
Vaibhav
One more check to do, is to run the same code for ntoh and hton on your PC which is little endian. That may help with any code issues.
Hello,
Thanks for all the suggestions.
It seems to me that maybe I confused myself and others too :
Checking with the suggested simple program does verify that the kernel "thinks" we're little-endiann.
If ntohs equals hsons it still does not mean that it is big-endiann architecture: if for example unsigned short temp = 0x0001, and we're using little endian architecture, then both ntohs and htons we'll result in the same value (0x0100) becuase they both replace the bytes order. it seemed to me strange at first that I get the same value and I thought that something is wrong here, but actually it does what it supposed to do.
Regards,
Ran