<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hello Mathias,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If the service you mention does not announce its presence, it is not compliant to mDNS specifications – unfortunately.  So if the client “browse” operation for that service is already ongoing while the service is started, it may indeed
 take long before the client eventually resends its mDNS query. (The specification mentions up to 1 hour for query resending time.) So if possible the service should be fixed ;)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The mDNS standard RFC 6762 does provide a way to discover such a service, which is the One-Shot Multicast DNS Query (Section 5.1).
<o:p></o:p></p>
<p class="MsoNormal">This is the simplest type of mDNS client. It may be operated even in addition to the full/regular mDNS Querier (Section 5.2) that avahi implements. It sends a one-shot query from a different source port so it can work alongside the avahi
 daemon.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When using such one-shot client, it’s important to make the query specific to the (misbehaving) service or service type to discover, to avoid clogging the network with many responses from non-relevant services.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I haven’t found any code for the one-shot client within avahi, maybe others know this?<o:p></o:p></p>
<p class="MsoNormal">There are some webpages explaining to use ‘dig’ or ‘nslookup’ tools to test one-shot mDNS queries. And there’s some code mentioning it here:
<a href="https://github.com/mjansson/mdns">https://github.com/mjansson/mdns</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">A “hack” solution could also be to restart Avahi-daemon such that its cache is cleared and it is forced to send out an mDNS query as soon as the running application reregisters to the daemon.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards<o:p></o:p></p>
<p class="MsoNormal">Esko<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">IoTconsultancy.nl  |  Email/Teams: esko.dijk@iotconsultancy.nl
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> avahi <avahi-bounces@lists.freedesktop.org> <b>
On Behalf Of </b>Mathias De Roover<br>
<b>Sent:</b> Monday, November 14, 2022 17:08<br>
<b>To:</b> avahi@lists.freedesktop.org<br>
<b>Subject:</b> [avahi] Ensuring prompt reconnect to services that do not announce themselves<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Dear avahi community,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I'm using the avahi-client interface (C api) to create a service-browser with the goal of listening to the presence of a specific service in my network.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">It appears however that this service does not automatically announce itself when it joins the network but does react to MDNS queries.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">This results in quite a delay between the connection and the discovery (more than 15 minutes).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Does a method exist by which I can regularly schedule these MDNS queries so that I have guarantees about the time between connection and discovery?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks in advance and kind regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Mathias<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>