🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #2449

Little/Big Endian

#2449
From: Endian
Date: Wed, 12 Apr 2006 15:29
27 lines
1711 bytes
Assume that we want to communicate (a) via RS232 and  (b) via ethernet 
between a PC and an ARM based embedded controller unit (and/or a PDA)

Assume that most of the communication consist of transmitting/receiving of 
messages similar to the following structure. Also assume that both PC 
application and ARM application use the same header files for the messages.

typedef struct {
     short int    A;
     int            B;
     float        C;
     double    D;
     unsigned char  E;
}MyStruct;


Becasue Pentium processor in PC and ARM processor in the embedded unit use 
different endians (litte & big endians) the byte orders in the transmitted 
and received structures will be different.

How to solve this little/big endian problem?

How to make PC application send/receive structures to a ARM based embedded 
unit  (a) via RS232 and  (b) via ethernet between without worrying about the 
endians?

Regards.
Technical Details
Message-ID: <443d1ceb$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,b7bbc0a1e538a2f9,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: <Endian>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Little/Big Endian
Date: Thu, 13 Apr 2006 01:29:47 +1000
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 220.239.18.90
Message-ID: <443d1ceb$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1144855787 220.239.18.90 (12 Apr 2006 08:29:47 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail