esp8266_mdns icon indicating copy to clipboard operation
esp8266_mdns copied to clipboard

Announce a service

Open daspuru opened this issue 6 years ago • 7 comments

Hi!

Your library looks great! however it is not clear to me if it has the ability to announce services via mDNS or just querying ?

It would be awesome to announce services with you library as native ESP8266 mDNS does not work.

Thank you a lot.

daspuru avatar Aug 01 '18 21:08 daspuru

No, as it is this library only sends MDNS queries and watches for MDNS updates. That's all i needed when i wrote it.

There is definitely code out there for doing MDNS announcements. There are a few Arduino esp8266 libraries for Announcements. I haven't used any of them though.

I /think/ the Arduino OTA update code uses MDNS so that code definitely works. It's possible i'm not remembering correctly though. It's been a while since i played with this stuff.

mrdunk avatar Aug 02 '18 14:08 mrdunk

How does esp8266_mdns compare to the mDNS functionality that comes out-of-the-box with the ESP8266 and ESP32 cores? (Those seem to be rather broken... is this one expected to be better?)

probonopd avatar Aug 02 '18 19:08 probonopd

Hi ! both implementations, the native one in the latest AT firmware of the ESP8266, and the one in the Arduino Core, believe it or not, DOES NOT WORK for publishing services. The service is published and after some minutes it disappears, I have searched and searched the web and forums and there is no official response for that... that is why I am seeking an alternative...

daspuru avatar Aug 02 '18 19:08 daspuru

At least it's not just me ;-)

https://github.com/esp8266/Arduino/issues/457 https://github.com/esp8266/Arduino/issues/4970#issuecomment-408622301

The mdns code hasn't changed much. What has changed (I.e. corrected) is lwip, and how packets are handled. What has also apparently changed in some cases is the increase in features in some devices, how strict some devices are wrt mdns compliance, and what happens when faced with devices that are not so compliant, hence the whole discussion about passing Apple's conformance tests. A trivial/partial mdns implementation seems to no longer be enough.

probonopd avatar Aug 02 '18 20:08 probonopd

Yeah you are not alone ! that is why I ended up with hope in this code, as it manages the mDNS queries with a different approach, and directly to the UDP Socket. I believe with some understanding of this repo it should be able to make a service announcement directly over UDP and response to queries...

daspuru avatar Aug 02 '18 20:08 daspuru

Sorry for the delay; I forgot about this thread.

So this repo would certainly be a good starting point to do just about anything with mDNS. There is code here for creating and parsing raw mDNS packets. You would have to read and understand RFC6762 though: https://tools.ietf.org/html/rfc6762

I didn't look into this when i was first playing with this code as i presumed the existing mDNS announce code was adequate.

mrdunk avatar Sep 20 '18 09:09 mrdunk

Thanks @mrdunk, great document! It seems like a great job to do! I am starting to test the ESP32 module to see if it works better.

daspuru avatar Sep 21 '18 13:09 daspuru