-
Notifications
You must be signed in to change notification settings - Fork 13.3k
mDNS not working #4790
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
mDNS works for me. And if you don't fill out the required information from the issue template nobody is going to take your failure seriously. |
Hello, I changed my post, sorry. I have read many posts about mDNS and sometime it work and sometimes not ! The integration is simple and I don't see why it is not working, and I don't see if the problem comes from my computer why it works with other mDNS implementation ? Best regards, |
Hello, I try another board ESP32 Wemos LOLIN with the same program, iMac and iPhone i just change to ESP32 include : #include <WiFi.h> It's work fine ! Strange no ? |
There are big differences in the implementation so I'm not surprised by this. When you revised the issue and stated that you are using MacOS I thought that might be part of the problem. The mDNS code is being looked at, a rewrite, but it is not a very high priority mainly due to the complexity and the amount of work involved. So I don't expect anything new for a while. The only thing I can suggest is using a program like Wireshark and try and determine where things are failing. If I had an Apple computer I would try and look into this but I don't so I can't. |
I download Wireshark and try to look why ! The ESP32 library works fine but after some time stop to work, the ESP32 it not freeze and the webserver work but only with ip address... Thanks for all this informations !!! |
@RudyFiero is correct. In the esp32 framework, MDNS is a wrapper around the IDF implementation, which is completely different from ours. In fact, that implementation actually passes Apple's conformance tests, while our naive code does not. |
Marking as Waiting for feedback, pending details about what's wrong and a fix. |
Hello, I have the same problem of mDNS and sometimes it works and sometimes not. I'm using ESP8266 and the mDNS_WEB_Server example. I have bonjour installed, but I can not connect to it, I put the IDE with debug enable and the output is this: When accessed by IP: New client New client When I access for esp8266.local /: : rcl I hope this information helps you. And if anyone already has news, thank you for saying so. Cump Joel Mendes |
#include <WiFi.h> i am using this and when i connect my pc and esp32 with the same network it is working in browser but in the android device i need to enter the ip address to access the esp32.What should i do to correct it. |
Closing in view of #5442 with a full rewrite of mdns. |
The example code I've found on the web for mDNS does not work for me. It's the same issue as the OP. I dug through the library source code and the example code did work. Every time! There are quite a few differences in the code so I took each line from the working code and put it into the non working version. The line that is missing is the non working code is the following: void loop() { Hope this helps somebody. If you want to check out the example code you can find it here on MacOS: |
I am no software guy by any means yet tried activating mdns on android by installing printer apps like LetsPrintDroid , Printershare and Printbot which use mdns and lo and behold - both chrome and firefox immediately started recognizing esp8266.local! It may be useful for many of us to simply install these apps so that browsers on android become useful on iot plateforms. May be some of the wise software guys find out which of the three did the trick. |
I spent a week trying to find why my ESP8266 mDNS wasn't working. via browser I wasn't able to access ' esp8266.local ' finally it worked when i used ' esp8266./ ' Also this worked in Chrome on Android and on Windows both with and without bonjour installed on Windows. |
That one may have been resolved by your local DNS+DHCP server.
That is a further reason in favor of your router. |
I will try to find the problem in Windows and report back if I find it. But for now, I can access my ESP via ' esp8266./ '. I had bonjour installed, ' esp8266.local ' still didnt work. ' esp8266./ ' worked both with and without bonjour installed on Windows. Basically, ' esp8266./ ' worked universally. |
Hello, I do not know if this is critical, but I have this in my setup() function: And I am also registering an http service on port 80: |
For what it's worth : simply starting MDNS in |
@EricDuminil Can you retry with git head version or beta release version and open a new issue if you can reproduce it (with MCVE or a reference to a relevant existing example) ? |
@d-a-v Sorry, the problem is hard to reproduce, so I cannot give a MCVE. This issue espressif/arduino-esp32#4406 seems to be the closest to what I'm experiencing. |
Are you experiencing issues with mDNS on esp32 or esp8266? |
@d-a-v Sorry about that, I realize it wasn't clear at all. I'm experiencing these problems with an esp8266. The symptoms are exactly the same as in the linked issue, which was indeed described for an esp32. |
We need to be able to reproduce. We still don't know what version of the core you are using nor if you experience such issue with the provided mDNS examples. mDNS has had such issues you describe but has been recently updated. You need to try with git master version of this esp8266 core, or with the beta release version installable on arduino ide. |
@d-a-v As far as I can tell, the core version I use is 2.6.2 with PlatformIO, and 2.7.4 with Arduino IDE, both with the same behaviour. |
About PlatformIO here is an unofficial answer after a google search: platformio/platform-espressif8266#49 (comment) edit Our official answer: |
@d-a-v Thanks a lot. I used https://d-a-v.github.io/esp8266/Arduino/package_esp8266com_index.json in Arduino IDE and tried both git:'2.7.2-182-g8b662ed3' and git:'2.7.2-365-g96c62677'. The problem still persists. Using the "mDNS_Web_Server.ino" example (the only modification was for SSID & password), the ESP8266 stops answering at http://esp8266.local after 2 minutes. The HTTP server still answers when using the local IP. One ugly workaround is to force a restart:
every 30 seconds, but it seems to create a memory leak (~224 bytes at every restart). |
@EricDuminil @d-a-v
Can you retry with this updated example and report back ?
|
@hreintke Sorry, it shows same behaviour as before. (I had to uppercase the
Actually visiting the website regularly (with Firefox & Chrome on Linux Mint 19.3) as opposed to merely pinging Note that it might start answering at |
@EricDuminil Can you try |
My observations have been very similar to @EricDuminil in that the service disappears after a couple of minutes. Isn't the TTl 120 seconds? Hmmm... For giggles, I added I think that |
@EddieGreen can you also try with the latest git version or the snapshot release ? |
@EddieGreen @d-a-v |
Just tried 0.0.2. It looks like MDNS maintains the service record but I can't be sure because command line I'm using a timer with 15ms intervals to control an RGB LED using FastLED. Changes in the ESP8266 library seem to be causing interruptions to this processing as the LED flickers and changes colour randomly. I also have had some inconsistent rebooting. What I have that works with 2.7.4 is this:
I'm sure this is a hack but it's working reliably and is a solution to the many posts on this subject. |
It looks fine to me. Why is it a hack ?
I too observed this issue, that does not happen with NeoPixel. I opened an issue. |
@d-a-v I prefer getting into the details and fix. |
I have some users (random) that do not have mdns resolving, some do get it to work. I have no clue what the difference is. But I keep getting people that report the multicast dns is not working for them. Is there any progress on this issue? |
mDNS was not working for me as well. I was using MDNS.begin("esp8266") within the if construct as suggested in many posts. I then added MDNS.addService("http", "tcp", 80); in void setup(). It did not work. I then added MDNS.update(); in void loop(). All this while I had been pinging or browsing esp8266.local/ or esp8266./ as suggested in some of the posts. Spending almost a day and out of frustration, I then just pinged esp8266 and it worked. It worked on browser also when I typed http://esp8266 . I then removed MDNS.update() and MDNS.addService one by one and it did not work. So, following statements related to mDNS worked for me
I hope this may help someone and save valuable time for him/her. Best, |
For esp8266 I am using libraries #include <ESP8266WiFi.h> but mdns is not working. please help me |
@MohithReddy1 Did you try one of the examples with the latest version of this core ? |
Hello, I ran into the same issue where esp8266 was not responding on mDNS requests for .local. Moving the MDNS.begin("") and MDNS.addService("http", "TCP", 80) code after the webserver (TCP/80) was started made it working for me. The MDNS.update() inside the void loop() was not needed. |
I still don't understand where the problem is coming from. It's really weird, though. |
I think I know why a lot of users are experiencing this issue. If ArduinoOTA is used and started using ArduinoOTA.begin() and no hostname was set using ArduinoOTA.setHostname, the library will start MDNS and override the hostname with something like esp8266-xxxxxx where x is the chip id. The solution is to either call ArduinoOTA.setHostname to set the hostname and remove your own calls to the MDNS library or to call ArduinoOTA.begin(false) to prevent the library from using MDNS and leave your calls to MDNS. The argument to begin is defaulted to true so it uses MDNS. |
@faelenor : For what it's worth, I've encountered the above problem a few times, but never used ArduinoOTA. |
This one worked for me pretty well. |
I have same issue on ESP32. Add following code to loop function solves my problem :
|
possible to share your mock code? it is not working from my end |
The problem is actually with the ESP8266MDNS library from SDK 2.5.0 and up |
was having similar issues here with the latest platform sdk.
If you are using ArduinoOTA, Remove all references to mDNS in your sketch and go with the following... in
and inside
This fixed oddities I was having with espota post version bump of the platform sdk and restored mDNS functionality on my ESP8266 board. |
Platform
Settings in IDE
Problem Description
Hello,
I try to use the mDNS library with Wemos mini D1 pro, and that's not working !!!
When I ping the ip it's work, when I ping other .local equipment it's working but when I try to ping or use in some different browser the esp hostname (uvpm.local) a got an error ???
I use mac os with high sierra, iPhones with some different network tools and "bonjour" mDNS scanner, I can see the ip and the open port but not the hostname.local
Esp8266/Arduino v2.4.1
I try to use the MDNS.begin before and after the serveurweb.begin();
Best regards,
MCVE Sketch
wifiManager.autoConnect("UVPM","mdp");
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
serveurWeb.begin();
printHTTPServerInfo();
if (!MDNS.begin("uvpm")) { // Start the mDNS responder for esp8266.local
Serial.println("Error setting up MDNS responder!");
}
Serial.println("mDNS responder started");
// Add service to MDNS-SD
MDNS.addService("http", "tcp", 80);
The text was updated successfully, but these errors were encountered: