-
Notifications
You must be signed in to change notification settings - Fork 13.3k
mDNS Server does not "Probe and Announce" on startup #4591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have don some further testing and gone through the code step by step and it seems that the problem is nothing to do with this library. I am closing this issue but for anyone having the same problem I have asked the question on StackOverflow. |
I have done some more testing and installed Homebridge on a Mac and monitored it's mDNS packets using WireShark. On startup of the server it sends out a couple of "ANY" queries and a couple of responses. What it is doing here is as described in section 8 of RFC 6762 namely, "Probing and Announcing on Startup". I am hoping that any contributors will be able to implement this as ESP8266mDNS currently does not send out any mDNS packets on startup. I will attempt to implement this on my side and maybe make a pull request if I get things to work. |
Be aware that I am currently rewriting the mdns responder/query based on the idf implementation. It is very slow going, though, so it will take quite some time. |
Thanks for the heads up! Does the idf implementation incorporate probing and announcing? In case it does I can close this issue as it will be already accounted for. |
The idf implementation is supposed to be complete enough to pass Apple's conformance tests, and I believe that is needed for HAP support, among other things. |
Indeed, I couldn't get this to pass the conformance test. It failed before I could even get any useful info. Hoping this will be finished soon, in the meantime I'll have to figure out a way to get it to work temporarily. I'll be closing this issue for now as this will not be relevant in the new version. Thanks for your help! |
Basic Infos
Platform
Settings in IDE
Problem Description
Update
I have don some further testing and gone through the code step by step and it seems that the problem is nothing to do with this library. I am closing this issue but for anyone having the same problem I have asked the question on StackOverflow.
Update 2 (Reopened)
I have done some more testing and installed Homebridge on a Mac and monitored it's mDNS packets using WireShark. On startup of the server it sends out a couple of "ANY" queries and a couple of responses. What it is doing here is as described in section 8 of RFC 6762 namely, "Probing and Announcing on Startup". I am hoping that any contributors will be able to implement this as ESP8266mDNS currently does not send out any mDNS packets on startup. I will attempt to implement this on my side and maybe make a pull request if I get things to work.
I'm trying to setup an HAP (HomeKit Accessorie Protocol) service with mDNS to be discovered by HomeKit on iOS devices. However in normal circumstances I can't see the device in the Home app.
I have tried the things below with varying results:
Test: Downloaded a Bonjour discovery app on my iPhone called "Radar".
Result: When the mDNS service starts the app will show that there is some kind of HAP service available but when I click on it (which shows devices offering that service) I see nothing. It seems the iPhone knows there is a service but doesn't know which devices are offering it.
Test: Changed the service offered from "hap" to something else and tested with the app above.
Result: The service and the device both show up in the app so that is all working fine. It seems to be only a problem with "hap". (When I use "homekit" as the service it gives the same result as "hap".
Test: Used "dns-sd" on a mac to try and discover the HAP service.
Result: This works just fine and the service + device are discovered. After doing this iOS is also able to discover the device in both the "Radar" app and in the "Home" app. It seems the iOS device is somehow also receiving the mDNS response that was sent back to the home app.
Test: Following up on the above, I programmed another esp8266-01 to continiously query the HAP service (as with dns-sd).
Result: Everything works as expected but this is not really a solution as I would like to have the job done by only 1 esp module. This also makes me think that the library is not advertising the service properly or at least not to the expectations of the iOS device.
Test: Enabled debug messages.
Result: When using dns-sd on the mac, the requests come through correctly and are also responded to. When using the Radar app clicking (which sends a request) on "hap" I do not see any requests coming through, when clicking on any other service I see an ERR_NO_SERVICE (which is expected but shows the requests are coming through). Using the Home app and letting it search for devices does not give me any requests.
Test: Used wireshark to monitor mDNS packets on the networks.
Result: In normal circumstances the iOS devices does not seem to make any requests for HAP service when using either the Radar or Home app. This only starts happening after I "poke" a request from somewhere else such as dns-sd on the Mac.
Test: Let the esp query it's own service after it has been set up.
Result: This doesn't make a difference.
I have been spending 2 days trying to figure this out and I still haven't found a solution. From the above my guess is that somehow the mDNS library has to advertise this service in a slightly different way from everything else for the iOS device to discover it. Perhaps the service is not registered somewhere were it should and the iOS device is waiting for this to start sending it's requests. (This would then be fixed when making a request from dns-sd).
I really have no clue where to go from here and your help to fix this issue is appreciated!
MCVE Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: