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=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Broadcast / iterate to all Connection objects via Simple Components? Date: Sun, 19 Feb 2023 09:29:44 +0100 Organization: A noiseless patient Spider Message-ID: References: <392dd5d3-4df1-403f-b703-ee6f750dbc81n@googlegroups.com> <02802bf3-fc29-44da-bd79-21f26d122203n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 19 Feb 2023 08:29:45 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="b688fff65d5e218a4c1e9cadbb53e098"; logging-data="374519"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++2diBDDigVsrnbN3Q/OG+j/t/tj15YXo=" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Cancel-Lock: sha1:jIUneaw2aGbphHbd8PuQIwZzgIw= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:64939 List-Id: On 2023-02-19 02:27, A.J. wrote: > I couldn't get Send() to send more data than Available_To_Send (after calling it, Available_To_Send ended up returning 0, and continued to do so despite wrapping Send() in a loop), As it must because the outgoing buffer is full. You must save the client's state and return (=yield) at this point. When a portion of data is sent (taken from the buffer) the client's Sent primitive procedure will be called and from there the client can restore its state and continue. You cannot loop, it is pointless. You must yield. This was the essence of the whole discussion about the state machines vs. co-routines. Writing clients is *difficult*. > but increasing the send buffer to 8kb per connection worked fine. Sure in many cases there exist buffer size that guarantees sending [*]. This is not always the case. When not, the client must drop connection if it cannot sent. So, you will have unreliably working clients. -------------------- [*] Many industrial protocols have bounded the packet size and work in a query-answer manner. For these the output buffer size is roughly the packet size. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de