mDNS time to live
Posted: Mon Feb 25, 2019 3:24 pm
Hello,
I am using the mDNS APIs however I don't see any option to set the TTL of my mDNS service. The service is visible on an Android smartphone with the application "Service Browser" but only for a brief period of time (I would say one second).
However I need my service to be always visible and I can't find a solution to do that. Is there any workaround to be able to set the TTL of an mDNS service ?
For now the only way I have found for the service to be always visible is to register and unregister it continuously.
Here is a code sample of how I set my mDNS service
I am using the mDNS APIs however I don't see any option to set the TTL of my mDNS service. The service is visible on an Android smartphone with the application "Service Browser" but only for a brief period of time (I would say one second).
However I need my service to be always visible and I can't find a solution to do that. Is there any workaround to be able to set the TTL of an mDNS service ?
For now the only way I have found for the service to be always visible is to register and unregister it continuously.
Here is a code sample of how I set my mDNS service
Code: Select all
const char* name = "hostname";
const char* service = "myservice";
const char* protocol = "tcp";
mdns_init();
mdns_hostname_set(name);
mdns_service_add(NULL, service, protocol, 80, NULL, 0);