From mboxrd@z Thu Jan 1 00:00:00 1970 From: gmate.amit@gmail.com (Kumar amit mehta) Date: Mon, 15 Oct 2012 01:28:52 -0700 Subject: Network Byte order not reached reading from a sock RAW In-Reply-To: <56AB56EAD87AF24C803FB693654D7A89CB08A9@adbbexch01.adbitaly.com> References: <56AB56EAD87AF24C803FB693654D7A89CAAC57@adbbexch01.adbitaly.com> <56AB56EAD87AF24C803FB693654D7A89CB08A9@adbbexch01.adbitaly.com> Message-ID: <20121015082852.GA4870@gmail.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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