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,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7db5fb0599fd4b76 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news2.google.com!proxad.net!teaser.fr!titine.scrogneugneu.org!jaco From: Eric Jacoboni Newsgroups: comp.lang.ada Subject: Re: TCP/IP Sockets with GNAT.Sockets Date: Mon, 02 May 2005 19:56:18 +0200 Organization: Rogntudju & Associates Message-ID: <020520051956181888%jaco@neottia.net> References: <1115001752.291144.218410@z14g2000cwz.googlegroups.com> <427618e9$0$7743$ba620e4c@news.skynet.be> <1115045740.838321.306480@g14g2000cwa.googlegroups.com> <42765108$0$22419$ba620e4c@news.skynet.be> NNTP-Posting-Host: 192.168.2.3 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: titine.scrogneugneu.org 1115056716 13286 192.168.2.3 (2 May 2005 17:58:36 GMT) X-Complaints-To: usenet@titine.scrogneugneu.org NNTP-Posting-Date: Mon, 2 May 2005 17:58:36 +0000 (UTC) User-Agent: Thoth/1.7.2 (Carbon/OS X) Xref: g2news1.google.com comp.lang.ada:10879 Date: 2005-05-02T19:56:18+02:00 List-Id: In article <42765108$0$22419$ba620e4c@news.skynet.be>, Adrien Plisson wrote: > > S : String := "Hello"; > > SEA : Stream_Element_Array(1..S'Length); > > for SEA'Address use S(S'First)'Address; > > Last : Stream_Element_Offset; > > Send_Socket( Socket, SEA, Last ); > > (i'm sorry i'm gonna be a bit rude) beuark ! Agree. It's not the sort of things i expected to write with Ada... But, that's the only code that fits my needs. > this is implementation dependant: > - what if Character'Size /= Stream_Element'Size ? > - what if the memory organization of Stream_Element_Array does not > match the one for a String ? For the second point, Stream_Element_Array is defined as an array of Stream_Element, so i suppose it match the memory organization of a String, isn't it ? > you'd better write this: > > declare > Socket : Socket_Type; > Channel : Stream_Access; > begin > -- open your socket here, then... > Channel := Stream( Socket ); > > String'Write( Channel, "Hello" ); > -- close your socket here... > end; Have you tried this code with a server not Ada aware? Have you tried to exchange messages with, say, a POP3 server? (to send and to read) I've tried to use Streams for that, but i never succeeded to make it work... If a cleaner solution exists, why the hell cannot we find _any_ example? -- jaco