Atozed Forums
TIdUDPServer connected clients - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Indy (https://www.atozed.com/forums/forum-8.html)
+--- Forum: Indy General Discussion (https://www.atozed.com/forums/forum-9.html)
+--- Thread: TIdUDPServer connected clients (/thread-2198.html)



TIdUDPServer connected clients - _b-har - 12-19-2020

Hello; is it possible to determine the clients currently connected to a TIdUDPServer?  I can do this with the TCP server, but have not found a way to do it with the UDP server.  Thank you.


RE: TIdUDPServer connected clients - rlebeau - 12-22-2020

(12-19-2020, 05:52 PM)_b-har Wrote: is it possible to determine the clients currently connected to a TIdUDPServer?

UDP is a connection-less protocol. There are no “connected clients”, only datagrams. You need to keep track of clients yourself in your own code. When you receive a new datagram from an unknown client, add that client to a list somewhere. If you don’t receive any datagram from that client for awhile, or if you receive a goodbye datagram (if your datagram protocol has one), remove that client from the list.

(12-19-2020, 05:52 PM)_b-har Wrote: I can do this with the TCP server

Because TCP has a concept of connections, and TIdTCPServer keeps track of them for its own purposes, but makes that list available to you as well.

(12-19-2020, 05:52 PM)_b-har Wrote: but have not found a way to do it with the UDP server.

Because there isn’t one.