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 by hostname - not working #1069

Open
quax1 opened this issue Nov 28, 2024 · 0 comments
Open

connect by hostname - not working #1069

quax1 opened this issue Nov 28, 2024 · 0 comments

Comments

@quax1
Copy link

quax1 commented Nov 28, 2024

Please ignore - works well in another WLAN - so it is a problem of my home WLAN and not of the library

Hello,
I want to connect to a mosquitto MQTT Server on my local network with the hostname instead of the ip adress. But connect fails, however, connect with IP is OK and connect with mosquitto_pub or MQTT Explorer using hostname works fine.

Seems to me that the hostname only is not enough...

Details
I used the current Basic ESP8266 MQTT example: mqtt_esp8266.ino

works OK with servername on internet:
const char* mqtt_server = "broker.mqtt-dashboard.com";

works OK with IP of my local server:
const char* mqtt_server = "192.168.2.33";

Now trying to connect with hostname - fail
const char* mqtt_server = "IMW1";

Attempting MQTT connection...failed, rc=-2 try again in 5 seconds

But connection with MQTT Explorer or with mosquitto publisher is OK:
just found out mosquitto_pub with hostname takes ca. 2s until it is transmitted, with IP it is immediate. So it is a problem in my network ?

mosquitto_pub -d -h "IMW1" -t testTopic -m "Hello world!"
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending PUBLISH (d0, q0, r0, m1, 'testTopic', ... (12 bytes))
Client (null) sending DISCONNECT

Probably it is stupid - but I do have no idea why it is not working.

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

No branches or pull requests

1 participant