Skip to content
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

Connect with hostname instead of IP #81

Open
josefgull opened this issue Mar 12, 2021 · 3 comments
Open

Connect with hostname instead of IP #81

josefgull opened this issue Mar 12, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@josefgull
Copy link

i want to connect via the hostname instad of the ip. but it only works withe ip if use the hostname in my broser i can reach the pc:/(/
works
client=new EspMQTTClient (con.WifiName,con.WifiPass,"192.168.0.102", "", "", con.Nodename, 1883 );
works not
client=new EspMQTTClient (con.WifiName,con.WifiPass,"myhostname", "", "", con.Nodename, 1883 );

@josefgull josefgull added the bug Something isn't working label Mar 12, 2021
@plapointe6 plapointe6 added enhancement New feature or request and removed bug Something isn't working labels Nov 30, 2021
@plapointe6 plapointe6 changed the title hostname resolution Connect with hostname instead of IP Nov 30, 2021
@githubbuh
Copy link

plapointe6,

I wonder if a better name for this enhancement would be: Connect with hostname OR ip address because I am sure it is not intended that this enhancement would be a breaking change for all who want to connect using an IP address.

Thanks in advance,

githubbuh

@EdJoPaTo
Copy link
Contributor

Using a hostname works for me. I have never used IP addresses with this library.
My in-home MQTT Broker uses DHCP and has a hostname which I use to connect to it which works fine. Not sure what the problem is or if I am overlooking something?

@Rosen01
Copy link

Rosen01 commented Jan 26, 2023

I confirm that it's working with the hostname.
Looks like there is a DNS problem in your network.

The "myhostname" is not registred on the referenced DNS on the ESP32, perhaps you use different DNS server for the ESP32 and the myhostname server, or the registred computer has another name in the DNS like "myhostname.local",
If you're have referenced an external DNS on every computer on your network you won't be able to register local computer.

Check the result of the command on the myhostname server and on another computer that is on the same network as the ESP32 :
nslookup myhostname

If it's correctly registred on the DNS, you will have a result like :

Server: <DNS Server name or IP>
Address: <DNS Server IP>

Name: myhostname
Address: <myhostname IP>

I think the issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants