This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Network programming for eCos under linux


On Wed, Aug 08, 2001 at 09:13:19AM -0600, Trenton D. Adams wrote:

>> > > Watch out for endianness issues. i386 linux is little endian.
>> > > Whats the endianness of your target? Things like this affects
>> > > network code.
>> >
>> > This shouldn't pose a problem since I've configured my ARM as
>> > little-endian.  However, htons (), htonl (), etc should solve
>> > that problem anyhow, shouldn't it?  I mean as far networking
>> > code goes that is.  I would obviously have to be careful about
>> > data types between the two if they were different.  It's nice
>> > to have the ARM with 32-bit little-endian!  Makes my life a lot
>> > easier since I'm sending data to a PC.
>> 
>> You're headed for trouble.  I work on software where the author
>> "knew" data was being sent from one little endian machine to
>> another over the network.  Unfortunately one of the ends is now
>> big-endian, and it's now a royal PITA to maintain this stuff.
>> Unfortunalyte there aren't standard host-to-little-endian and
>> little-endian-to-host macros.
>
> How so?  Are you referring to the networking code, or the data
> types?

Application data.

> We're not going to be sending to anything other than a PC so
> either way it shouldn't be a problem should it?

Just like the code I'm working on would never be sending to
anything other than an x86.  Except the x86-based box has been
replaced by a big-endian ARM box.

-- 
Grant Edwards
grante@visi.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]