-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
CircuitPython version
Adafruit CircuitPython 9.1.3 on 2024-08-30; Seeed Xiao ESP32-C6 4MB Flash 512KB SRAM with ESP32-C6FH4Code/REPL
socketpool = socketpool.SocketPool(wifi.radio)
addressInfoTupple = socketpool.getaddrinfo("cats.com", 80)
for individual_addressInfo in addressInfoTupple:
print(f"individual_addressInfo: {individual_addressInfo}")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.
$ host cats.com
cats.com has address 172.67.39.47
cats.com has address 104.22.47.85
cats.com has address 104.22.46.85
.....
In python I get a List of all the ip addresses, A records, from the host.
individual_addressInfo: (2, 1, 0, '', ('172.67.39.47', 80))
individual_addressInfo: (2, 1, 0, '', ('104.22.47.85', 80))
individual_addressInfo: (2, 1, 0, '', ('104.22.46.85', 80))
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 ???