From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f25e636d6b770960 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-25 14:45:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Last stream problem: byte order Date: 25 Mar 2002 17:36:15 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1017096107 24446 128.183.220.71 (25 Mar 2002 22:41:47 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 25 Mar 2002 22:41:47 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:21661 Date: 2002-03-25T22:41:47+00:00 List-Id: Erik Sigra writes: > Now my stream application almost works. The last remaining problem > seems to be byte order. The server is programmed in C++ with Qt and > the client is programmed in Ada with adasockets-1.0. The last thing > I did was to change the byte order in the server > ("the_stream.setByteOrder(QDataStream::LittleEndian);"). After that > the numbers came out right at the other end. > > However, this may not be a safe solution. The safe way would probably be to > always have the network communication in BigEndian format and make sure the > client always obeys this, regardless of the platform. > > So how does one set the byte order to BigEndian on the Ada side? By writing code that does it :). There is a package Word_Order_Convert in SAL at http://users.erols.com/leakstan/Stephe/Ada/sal.html Note that's _word_ order convert; you'll need _byte_ order convert. Should be easy to change. I was working with 1553 buses, which are all 16 bit words. > Or is there a different, better idea? You can use a higher layer communications package, that does byte swapping for you. There is one called XDR in the GNAT GLADE distributed annex package. -- -- Stephe