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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Ada x Datagram Sockets Date: Thu, 7 Feb 2019 19:00:03 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 7 Feb 2019 18:00:04 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="5599220316738c3b073c428a65c1105b"; logging-data="26983"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rwMkCOZb56mV7Z3CXJMD8lZKa9aauYjo=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 Cancel-Lock: sha1:UoQ7FMX/jovNT4zoNYVTa61gsyE= In-Reply-To: <519fd5e0-eb4e-432e-85cc-d7a37510c957@googlegroups.com> Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:55460 Date: 2019-02-07T19:00:03+01:00 List-Id: On 2/7/19 12:47 PM, Jere wrote: > > In Ada you are telling it to receive: > > Wrong. According to ARM 13.13.2(26/3) says, "If T is an array type, S'Output first writes the bounds, and S'Input first reads the bounds." Ada arrays do not necessarily have a lower bound of 1. So String'Input will first try to read 2 integers, the lower and upper bounds of the array. Presumably it runs out of data while reading the 2nd, leading to the exception. 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 -- Jeff Carter "Now go away or I shall taunt you a second time." Monty Python & the Holy Grail 07