mdns icon indicating copy to clipboard operation
mdns copied to clipboard

Howto listen to changes after first query.

Open stefbon opened this issue 2 years ago • 2 comments

Hi,

implementing this library in my own project, I very much want to know howto listen to changes like a host (with dns services) is showing upp or removed for example. A socket/fd for every interface has to be listning to this (and watched by an eventloop). And then?

Stef

stefbon avatar Jan 11 '23 05:01 stefbon

Can I use the mdns_announce_multicast to let other mdns hosts know my software is interested in announces/goodbyes (==changes in services and/or hosts going down)?

stefbon avatar Feb 13 '23 12:02 stefbon

I've found the following: MDNS responders should send an unsolicited Multicast response packet, with the exact same values it would send after a query for services, but then with TTL zero. This enables listning and receiving neighbours to delete the entry from their cache. (see: rfc6762). Also - when a host is not configured properly, is crashing or is not working according the specs, I think it would be smart to

  • a client to poll on a regular base for services (how often?)
  • a callback to the mdns query software should be enabled when the application has indications a host is down/has become unreachable (for example when connections with this host are shutdown in a non proper way).

Maybe add this in the example software.

stefbon avatar Aug 10 '23 03:08 stefbon