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,b283baa6a69c5e41 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-17 08:54:30 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.nuthinbutnews.com!propagator-sterling!news-in.nuthinbutnews.com!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc02.gnilink.net.POSTED!c6285fe0!not-for-mail Message-ID: <3CE53654.BFE78158@gte.net> From: "Robert L. Klungle" X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.5 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Byte order writing to socket stream References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 17 May 2002 15:54:29 GMT NNTP-Posting-Host: 4.33.2.152 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc02.gnilink.net 1021650869 4.33.2.152 (Fri, 17 May 2002 11:54:29 EDT) NNTP-Posting-Date: Fri, 17 May 2002 11:54:29 EDT Xref: archiver1.google.com comp.lang.ada:24281 Date: 2002-05-17T15:54:29+00:00 List-Id: The Darkelf wrote: > Hi, I have an Ada program with GNAT.Sockets that works fine when client > and server are in the same architecture. The problem is when client runs > on HP and the server on Intel, or viceversa. > > It raises a STORAGE_ERROR exception, when it reads an array from the > socket stream. I guess the problem must be the byte order, so one solution > should be to write the size of the array(integer) and then the elements of > the array (strings), checking the integer byte order. > > Can the conversion to the net standard be done "on the fly", as I do the > Stream'Output(stream,theArray), or it's necesary to manually output each > element? > > If so, any suggestion for checking the architecture byte order and > ouputing it in some standard way? > > May it be easier or better to just output the integer values as strings > (Integer'Image) ? > > Thanks for your opinions and suggestions. > > Alvaro J. Iradier Muro FWIW, had the same problem a while ago. CORBA was an option (complex fix). Doing byte swapping assumes apriori knowledge of incoming data format(s). Did the string thing and all worked ok (although a little slower than otherwise). cheers....bob