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.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a24:4105:: with SMTP id x5mr294303ita.33.1549658157710; Fri, 08 Feb 2019 12:35:57 -0800 (PST) X-Received: by 2002:a05:6808:1cd:: with SMTP id x13mr21234oic.0.1549658157246; Fri, 08 Feb 2019 12:35:57 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!q69no324482itb.0!news-out.google.com!9ni190itl.0!nntp.google.com!k10no324024itk.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 8 Feb 2019 12:35:56 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=191.17.174.180; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu NNTP-Posting-Host: 191.17.174.180 References: <47f17695-f9a5-4024-b2da-3f13209dc4fd@googlegroups.com> <818f5ff4-f18d-42b8-950d-9b597c012aa4@googlegroups.com> <62406dfb-54c9-4db3-b461-0ad72d4a782c@googlegroups.com> <519fd5e0-eb4e-432e-85cc-d7a37510c957@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9c63d0be-fffa-4dab-a879-921fd723b8d8@googlegroups.com> Subject: Re: Ada x Datagram Sockets From: "Rego, P." Injection-Date: Fri, 08 Feb 2019 20:35:57 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2692 X-Received-Body-CRC: 2123674988 Xref: reader01.eternal-september.org comp.lang.ada:55471 Date: 2019-02-08T12:35:56-08:00 List-Id: > What the OP needs to do is > > 1. Get Length, the length of the data. > 2. Create C : Interfaces.C.char_array (1 .. Length) > 3. Transfer the data into C > 4. Use Interfaces.C.To_Ada (C) to transform C into an Ada String Simple enough, would you know how transfer the data into this C? I am trying in this path loop -- Receive and print message from client Ping Channel := SOCKETS.Stream (Socket, Address); Text_IO.Put_Line (Integer'Image (Channel'Size)); declare Channel_Size : Integer := Integer (Channel'Size); type Buffer_Type is new Interfaces.C.char_array (1 .. Interfaces.C.size_t (Channel_Size)); type Stream_Buffer_Type is new String (1 .. Integer (Channel_Size)); function Copy_Arr is new Ada.Unchecked_Conversion (Buffer_Type, Stream_Buffer_Type); --Buffer : Buffer_Type; Stream_Buffer : Stream_Buffer_Type; begin --Buffer := String'Input (Channel); --!!!! Stream_Buffer := Stream_Buffer_Type (String'Input (Channel)); end; end loop;