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-18 01:11:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!blackbush.xlink.net!blackbush.de.kpnqwest.net!rz.uni-karlsruhe.de!schlund.de!news.online.de!not-for-mail From: "Dr. Michael Paus" Newsgroups: comp.lang.ada Subject: Re: Byte order writing to socket stream Date: Sat, 18 May 2002 10:11:24 +0200 Organization: 1&1 Internet AG Message-ID: <3CE60CAC.7020102@ib-paus.com> References: NNTP-Posting-Host: p508301ac.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.online.de 1021709484 24211 80.131.1.172 (18 May 2002 08:11:24 GMT) X-Complaints-To: abuse@online.de NNTP-Posting-Date: 18 May 2002 08:11:24 GMT User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0rc1) Gecko/20020417 X-Accept-Language: en-us, en Xref: archiver1.google.com comp.lang.ada:24341 Date: 2002-05-18T08:11:24+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 Hi, you could download my package http://www.ib-paus.com/downloads/AdaStreamsInNetworkByteOrder_020326.tar.gz and use it with your program. This will automatically convert all data into network byte order, so that you can work with mixed architectures. This is a modified version of a standard GNAT package and so only works with GNAT. Hope this helps Michael