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

usocket.gettaddrinfo does not work for IP addresses #97

Open
ritesh opened this issue Mar 19, 2017 · 1 comment
Open

usocket.gettaddrinfo does not work for IP addresses #97

ritesh opened this issue Mar 19, 2017 · 1 comment

Comments

@ritesh
Copy link

ritesh commented Mar 19, 2017

Calling usocket.gettaddrinfo() with an IP address and port number causes the badge to hang. I ran into this bug when trying to connect the badge to an MQTT server on my local network.

import mqtt
c = mqtt.MQTTClient('tilda', '192.168.1.2')
# hangs forever

The line that causes this is https://github.com/emfcamp/Mk3-Firmware/blob/master/lib/mqtt.py#L24

import usocket as socket
# This hangs
socket.gettaddrinfo('192.168.1.1', 1883)
# But this works fine
socket.gettaddrino('www.google.com', 1883)

usocket.gettaddrinfo() should work for both DNS names and IP addresses.

@marekventur
Copy link
Contributor

We have handled this case on the lib layer for HTTP, it might be easier to fix it on that level for MQTT: https://github.com/emfcamp/Mk3-Firmware/blob/master/lib/http_client.py#L161-L166

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

2 participants