62871

ESP8266 nodemcu resolving raspberry's local dns

Question:

I'm having an issue with connecting the esp module on the raspberry via mqtt. After a lot of search I think I am kinda lost now.

So here's the problem

I have setup my raspberry's local dns to work as cubex.local, I followed the instructions here:

<a href="http://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/" rel="nofollow">http://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/</a>

Everything seems to be working fine on this end...<br /> I can use the cubex.local on the local network to have ssh and ftp access to the raspberry but when it comes to the esp trying to resolve that address it keeps failing.

this is the code running on the esp:

function broker_connect() m = mqtt.Client(ID, 120, BRUSER, BRPWD) m:on("message", on_message_received) m:on("connect", on_connect) m:on("offline", on_mqqt_offline) tmr.alarm(0, 1000, 1,function() print("Connecting to MQTT broker at "..HOST..". Please wait...") m:connect( HOST , PORT, 0) end)

and the output:

<blockquote>

Connecting to MQTT broker at cubex.local. Please wait...<br /> DNS retry 1!<br /> DNS retry 2!<br /> DNS retry 3!<br /> DNS retry 4!<br /> DNS Fail!<br /> Connecting to MQTT broker at cubex.local. Please wait...<br /> DNS retry 1!<br /> DNS retry 2!<br /> DNS retry 3!<br /> DNS retry 4!<br /> DNS Fail!<br /> Connecting to MQTT broker at cubex.local. Please wait...<br /> DNS retry 1!<br /> DNS retry 2!<br /> DNS retry 3!<br /> DNS retry 4!<br /> DNS Fail!

</blockquote>

The host variable holds the cubex.local and the port is 1883.<br /> When I use the raspberry's IP which is 192.168.0.3 everything works fine.<br /> Still I fail to understand why it keeps failing to resolve the address.

Answer1:

Your hostname cubex.local is registered through mDNS, but mqtt query a DNS to resolve the hostname.

One option could be to use a DNS proxy to mDNS like <a href="https://github.com/wisq/mdns-proxy" rel="nofollow">mdns-proxy</a>, an other one is to modify nodemcu to query the mDNS directly.

Recommend

  • Checking if URL exists - HTTP Request always returns an exception
  • PDF file damaged after upload but local copy is fine. How could this be happening? [closed]
  • Is there a list of URL schemes?
  • `docker cp` doesn't copy file into container
  • Two columns in subquery in where clause
  • FTPWebRequest .NET 3.5 vs 4
  • I don't get what's the difference between format() and … (python)
  • How to check disabled jobs with Jenkins server?
  • Python Paramiko send CTRL+C to an ssh shell
  • How to load Q library with Require.js?
  • Mocha throws unexpected token error for ES6 object spread operator
  • Criterion causing memory consumption to explode, no CAFs in sight
  • JavaScript IE rotation transform maths
  • Private IP address in reserved subnet range
  • How to use jQuery's $.post() method with async/await and typescript
  • jwtBearer bearer token with rc-1 update to ASP.Net 5
  • Overlapping controls in Windows XP
  • Check for zero lines output from command over SSH
  • Should I or shouldn't I use the CachingConnectionFactory with hornetq 2.4.1
  • Assign variable to the value in HTML
  • Email verification using google app script and google forms
  • Setting up SourceTree to merge unity3d scenes with UnityYAMLMerge
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • script to move all files from one location to another location
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Redux, normalised entities and lodash merge
  • How can I estimate amount of memory left with calling System.gc()?
  • Apache 2.4 - remove | delete | uninstall
  • Matrix multiplication with MKL
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Benchmarking RAM performance - UWP and C#
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • How do you join a server to an Active Directory (domain)?
  • File not found error Google Drive API
  • python draw pie shapes with colour filled
  • Converting MP3 duration time