[ee122] Network byte ordering functions...
Daniel Killebrew
dank at eecs.berkeley.edu
Tue Nov 20 00:36:13 PST 2007
Daniel Killebrew wrote:
> Anthony Kilman wrote:
>
>> Quick question..
>>
>> Is there such a thing as htonc() [host to network (8-bit)char]?
>>
> No, most machines order the bits within a byte the same way,
Actually, I'm not really sure about this part, but when you write bytes
a a time over the network, it seems to work regardless.
Daniel
> it's the
> bytes within a 16bit or 32 bit word that can be ordered differently.
>
>> If not,
>> what is the easiest way to determine the "endian-ness" of the machine?
>>
>>
> If you know the processor, google. If you have access to the source of
> the C standard library, you could look at the source for htons(). Or
> write a 32 bit word to memory, then read the memory locations out a byte
> at a time and see what order you get them in.
>
> Daniel
>
>> Thanks in advance.
>>
>> Anthony
>>
>> _______________________________________________
>> ee122 mailing list
>> ee122 at mailman.ICSI.Berkeley.EDU
>> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122
>>
>>
>>
> _______________________________________________
> ee122 mailing list
> ee122 at mailman.ICSI.Berkeley.EDU
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122
>
>
More information about the ee122
mailing list