From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!aioe.org!sVKkdTGubB6QhuTA1Vyf1Q.user.46.165.242.75.POSTED!not-for-mail From: Mark Gardner Newsgroups: comp.lang.ada Subject: Sockets, Streams, and Element_Arrays: Much confusion Date: Sat, 31 Dec 2022 14:11:55 +0200 Organization: Aioe.org NNTP Server Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="13151"; posting-host="sVKkdTGubB6QhuTA1Vyf1Q.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: en-GB X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:64747 List-Id: Hello, I've been having a bit of difficulty doing some UDP socket programming in Ada. As outlined in my stackoverflow question here (https://stackoverflow.com/q/74953052/7105391), I'm trying to reply to messages I am getting over UDP. GNAT.Sockets gives me a Stream_Element_Array, which I can't find any documentation on how to make use of other than "You should also be able to get a Stream, which you should use instead" (About ten years ago, on this very newsgroup, somebody said not to use streams with UDP, or at least not GNAT.Sockets.Stream). Adasockets gives me a String, which I can work with, except it throws away the from data recvfrom gives it, apparently making it impossible to reply to the querying address. At this point, I'm half-tempted to make my own binding, but as I've never done that sort of thing before, I thought I'd ask the wisdom of the Usenet if there is a way to convert a Stream_Element_Array into the exotic types of Unsigned_16 and String.