Network Byte order not reached reading from a sock RAW

Kumar amit mehta gmate.amit at gmail.com
Mon Oct 15 04:28:52 EDT 2012


On Mon, Oct 15, 2012 at 07:46:08AM +0000, Pietro Paolini wrote:
> Hello,
> Thanks for your answer, my question is why when I read from the buffer data is already in host byte order and not in network byte order.
> Thanks 
> Pietro Paolini.
>
Hi Pietro,

The host doesn't care how the data has travelled over wire, he will store that 
data in memory according to it's own hardware architecture. As an application 
programmer, __you__ have to take care of this and to make your job easier, you
already have those ntoh* hton* APIs or your POSIX compliant OS.

-Amit



More information about the Kernelnewbies mailing list