help / color / mirror / Atom feed
From: Daniel Norte de Moraes <>
Subject: Re: Broadcast / iterate to all Connection objects via Simple Components?
Date: Mon, 13 Feb 2023 20:33:54 -0000 (UTC)	[thread overview]
Message-ID: <tse6rh$1igtm$> (raw)

Em Tue, 7 Feb 2023 12:29:39 -0800 (PST), A.J. escreveu:

> Hello everyone,

Hi! Wellcome!

> In an effort to better learn network programming in Ada, I've been
> working through the Protohacker Challenges (,
> and the current challenge (number 3) is to create a chat server.
> I am using a TCP Connections Server with Simple Components, specifically
> a Connection_State_Machine, but I've run into a problem.  I'm trying to
> send a message received via "procedure Process_Packet (Client : in out
> Server_Connection)" to all connected Clients.
> My (potentially incorrect) thought on how to accomplish this is to
> iterate through all of the clients currently connected, and use Send to
> send the message received to those clients.  I've been struggling with
> how to actually do this though, since I couldn't use "function
> Get_Clients_Count (Listener : Connections_Server) return Natural" from
> within Process_Packets.
> Another thought I had could be to just place every message received in a
> central queue, and then once all of the packets have been received, to
> then process that queue and send the results to every connected client.
> I tried overriding "procedure On_Worker_Start (Listener : in out
> Connections_Server)", thinking that I could use it to read such a queue,
> but it never seemed to be called from within my program and I'm still
> unsure how to iterate through the Connection objects anyway.
> Am I approaching this the right way, or am I missing something very
> obvious?  I've read the test files that came with Simple Components,
> including the data server but couldn't see a way to get each client to
> interact with each other.  If I didn't explain this well enough, please
> let me know, I'll be happy to clarify.
> Kind regards,
> AJ.

 Do you is obliged to use gnat-sockets ?

 Adare_Net has support to syncronous IO multiplex; 
 With Adare_Net you can create virtually infinite groups of network pools 
to get and send data on demand. and you can discover if peers closed 
connections and others things too. you can use syncronous i/o 
multiplexing  groups of network pools in dedicate ada tasks (or similar)  
to get truly real-time network programming and apps.


Each poll_type has a limit of 255 entries (more than that can be very 
slower) But you can have as many poll_types as you want.


Best Whishes,
GrateFull, Dani.

      parent reply	other threads:[~2023-02-13 20:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 20:29 Broadcast / iterate to all Connection objects via Simple Components? A.J.
2023-02-08  8:55 ` Dmitry A. Kazakov
2023-02-08  9:55 ` Jeffrey R.Carter
2023-02-13  7:28   ` Emmanuel Briot
2023-02-13  8:30     ` Dmitry A. Kazakov
2023-02-13  8:44       ` Emmanuel Briot
2023-02-13 10:55         ` Dmitry A. Kazakov
2023-02-13 11:07           ` Emmanuel Briot
2023-02-13 11:57             ` Dmitry A. Kazakov
2023-02-13 13:22               ` Niklas Holsti
2023-02-13 15:10                 ` Dmitry A. Kazakov
2023-02-13 16:26                   ` Niklas Holsti
2023-02-13 19:48                     ` Dmitry A. Kazakov
2023-02-15  9:54                       ` Niklas Holsti
2023-02-15 10:57                         ` Dmitry A. Kazakov
2023-02-15 18:37                           ` Niklas Holsti
2023-02-19  1:27                             ` A.J.
2023-02-19  8:29                               ` Dmitry A. Kazakov
2023-02-19 14:37                               ` Niklas Holsti
2023-02-13 15:43                 ` J-P. Rosen
2023-02-13 16:40             ` Jeremy Grosser <>
2023-02-13 20:33 ` Daniel Norte de Moraes [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox