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=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!aioe.org!2bOJBbN/dOuClNqbvu11SQ.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Sockets, Streams, and Element_Arrays: Much confusion Date: Sat, 31 Dec 2022 23:55:07 +0100 Organization: Aioe.org NNTP Server Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="60841"; posting-host="2bOJBbN/dOuClNqbvu11SQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:64758 List-Id: On 2022-12-31 23:32, philip...@gmail.com wrote: > I have to disagree here. UDP is perfectly fine for RPC-like (Remote Procedure Call) transactions on a local area network. RPC and other synchronous exchange policies should be avoided as much as possible. Saying said that, implementation of RPC on top of streams is incomparable more easier than on top of UDP. > And it is orders of magnitude easier to implement on microcontrollers than TCP. Not at all. You need: - Safe transmission and error correction on top UDP; - Buffering and sorting out incoming datagrams; - Maintaining sequence numbers; - Splitting messages that do not fit into a single datagram and reassembling them on the receiver side; - Buffering on the sender side to service resend requests. This is extremely difficult and huge load for a microcontroller. > Getting between Stream_Element_Array and a byte array is a pain and I wound up just looping over arrays, copying one byte at a time. If somebody has a better idea, let me know. Use "in situ" conversion if you are concerned about copying. E.g. pragma Import (Ada, Y); for Y'Address use X'Address; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de