chkaufmann 17 Posted October 29, 2020 I have two applications that communicate in a LAN using UDP. Both applications have TIdUDPClient and a TIdUDPServer. Until now the user must configure the port and the IP address. Now I would like a solution where client computers "find each other" automatically. What is the best way to do that? Regards Christian Share this post Link to post
Der schöne Günther 316 Posted October 29, 2020 UDP has a BroadCast(..) method https://stackoverflow.com/a/7424793/2298252 Share this post Link to post
Fr0sT.Brutal 900 Posted October 29, 2020 Send broadcast message with specific payload and address/port of sender Share this post Link to post
A.M. Hoornweg 144 Posted October 29, 2020 The "clean" way would be to use Bonjour a.k.a. ZeroConf. https://en.wikipedia.org/wiki/Zero-configuration_networking It is a somewhat "standardized" way of announcing all sorts of services using UDP broadcasts. Companies like Apple use it for discovering wireless devices such as printers. A zeroconf implementation can be found in the Remobjects suite ( https://docs.remotingsdk.com/Clients/Concepts/ROZeroConf/ ) but after some googling I found an open source implementation as well ( https://github.com/deltics/delphi.libs/tree/master/bonjour ). 1 Share this post Link to post
Fr0sT.Brutal 900 Posted October 30, 2020 22 hours ago, A.M. Hoornweg said: The "clean" way would be to use Bonjour a.k.a. ZeroConf. Too complex IMHO. Bonjour even requires DLL. But some concepts could be borrowed indeed Share this post Link to post
A.M. Hoornweg 144 Posted October 30, 2020 The disadvantage of all these broadcast methods is that they don't work across segmented LAN's. And then there's the can of worms called IPv6. Share this post Link to post
Rollo62 539 Posted October 30, 2020 (edited) 2 hours ago, A.M. Hoornweg said: The disadvantage of all these broadcast methods is that they don't work across segmented LAN's. If you want to cross segments, the you probably need a central broker, like MQTT provides. But I think the original thread request stay inside a local segment, where UDP would be an option. Edited October 30, 2020 by Rollo62 Share this post Link to post
Remy Lebeau 1436 Posted October 30, 2020 (edited) 3 hours ago, Fr0sT.Brutal said: What's so terrible in IPv6? Subnet broadcasting is supported only in IPv4, not in IPv6, you have to use multicasting instead. Edited October 30, 2020 by Remy Lebeau 1 Share this post Link to post
Dave Nottage 563 Posted October 30, 2020 3 hours ago, Remy Lebeau said: Subnet broadcasting is supported only in IPv4, not in IPv6, you have to use multicasting instead. ..and boy, is that fun 🙄 Share this post Link to post