also they use mDNS, which many programming languages, such as go, got it in their net library
1. Backoff and timer logic to not flood network.
2. Caching entries for the same reason.
3. Handling multiple network interfaces, and detecting when they changed.
for 1. i send a mutlicast of max 512 bytes on 224.0.0.167:26999 every 3 seconds 2. not really caching, just have a map of people that get discovered.
and god bless, I just rolled with this. if people will use the tool and they will complain about it, then it will be a problem for later. for me between my home devices did not notice inconveniences.
in total around 200 lines of golang.