I’m using legatos built in mqttClientService to connect to an external MQTT broker. However I can only provide ip address to the mqttClient_CreateSession.
If I try to use domain for that server, I receive:
mqttClientService[6672] | 20241023 062637.556 getaddrinfo failed for addr <url> with rc -2
mqttClientService[6672] | 20241023 062637.556 <url> is not a valid IP address
If i fetch the IP address on my own with getaddrinfo right before mqttClient_CreateSession, it returns IP address just fine and I can use it to connect to broker. The problem is that I can’t use ssl that way.
Seems like the mqttClientService cannot use dns or /etc/resolv.conf correctly.
I’m using legato 19.11.2 and my app is not sandboxed.
Any idea how to make mqttClientService understand domains?
However, using my own code to resolve server IP address is a bit whacky solution. Do you have any idea why getaddrinfo fails inside mqttClientService though it worked on my own code just a few lines earlier?
Does the firmware update if I change those to use newer version? e.g. 6.0.0?
And does the firmware update with the OTA update (.update file)?
I have tried to use the newer 6.0.0 but there is some problems with build that I have not figured out yet. But if I can use my own dns resolve at the moment, I try to update the legato version later.