You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am migrating my code from micropython to circuitpython and I noticed that my MQTT messages were not going through from the test device. I then found out one of my servers in my High Availability MQTT cluster was down. I was expecting it to just round robin my List of Tuples from getaddrinfo. Whats the point of outputting a List of Tuples if the list only ever contains 1 value ???
The text was updated successfully, but these errors were encountered:
meeki007
changed the title
socketpool getaddrinfo does not output the same as Python/MicroPython, Where is my List of multiple addresses.
socketpool getaddrinfo does not output the same as Python, Where is my List of multiple addresses.
Oct 12, 2024
This is a limitation of lwip, the socket library that is used by Espressif devices (and RP2040 wifi devices, when it comes to that). Their source code .../lwip/src/api/netdb.c states:
* Due to a limitation in dns_gethostbyname, only the first address of a
* host is returned.
* Also, service names are not supported (only port numbers)!
CircuitPython's implementation of getaddrinfo is prepared to return multiple addresses when you call socket.getaddrinfo but the underlying library doesn't provide multiple addresses yet.
CircuitPython's implementation of getaddrinfo is prepared to return multiple addresses when you call socket.getaddrinfo but the underlying library doesn't provide multiple addresses yet.
Good to know! I'll keep my for loop that tires connecting the mqtt client to each address so when this is implemented its waiting to work.
CircuitPython version
Code/REPL
Behavior
individual_addressInfo: (2, 1, 0, '', ('172.67.39.47', 80))
Description
I can see the host has multiple A records and addresses for the site.
In python I get a List of all the ip addresses, A records, from the host.
Additional information
See documentation ---> https://docs.circuitpython.org/en/latest/shared-bindings/socketpool/#socketpool.SocketPool.getaddrinfo
It says I should be getting a List of Tuples.
Why is this important .... to me.
I am migrating my code from micropython to circuitpython and I noticed that my MQTT messages were not going through from the test device. I then found out one of my servers in my High Availability MQTT cluster was down. I was expecting it to just round robin my List of Tuples from getaddrinfo. Whats the point of outputting a List of Tuples if the list only ever contains 1 value ???
The text was updated successfully, but these errors were encountered: