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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac2397ce800de518 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-04 07:05:25 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!psinet-eu-nl!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: adasockets and adatypes Date: Tue, 4 Sep 2001 09:43:06 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9n2lpb$c7b$1@nh.pace.co.uk> References: <20010904115244.24236db3.tonygair@blueyonder.co.uk> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 999610987 12523 136.170.200.133 (4 Sep 2001 13:43:07 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 4 Sep 2001 13:43:07 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:12694 Date: 2001-09-04T13:43:07+00:00 List-Id: Look into Ada.Streams and the 'Input and 'Output attributes. That will get a record type into a stream which you can then send down a socket. I believe Marc Criley wrote an article on this for a recent issue of Ada Letters, so if you have it or can get it, you may find a good description there of what you want to do. It works fine, except for...... You can't guarantee portability using these operations. If you have the same machine type, OS type, OS version, Compiler brand, Compiler version at both ends of the stream, you can be pretty sure that what you put into the stream will be picked apart properly at the other end. Violate one or more of those constraints and its all up for grabs. Note that this is a *theoretical* situation only. You might find that all versions of your compiler represent the data the same way on all platforms. You might even accidentally discover that multiple brands of compiler do the same thing. If you test the representation across your intended platforms and it works - great. Otherwise, you've got to build your own mechanisms to control the representation and get it into/out of the stream you are sending up and down the socket. Note that while I may complain about this from time to time, you're still better off than you are with C in the same situation. In C you have very little control over representation and in general just have to rely on the fact that most C compilers choose to do things basically the same way. The one advantage C has in this area is that it is at least simpler to take just about any data structure and treat it as raw bytes. You can get there in Ada, but it does require more work. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Tony Gair" wrote in message news:20010904115244.24236db3.tonygair@blueyonder.co.uk... > > Does anyone know a way of sending an adatype (especially a record of string and enumerated types) down a socket so it can be received by another ada program which recognises the type.... > > Regards > Tony Gair