I'm currently trying to run the mqtt_simple sample (latest version of nrf-zephyr) on the nrf9160 DK. Unfortunately it is not working, because getaddrinfo() returns 22 (EINVAL?).
I'm trying to run the sample using NB-IoT. For that I flashed the appropriate firmware (pre-alpha) and I'm also using an appropriate SIM-card. TCP connections alone (without getaddrinfo()) are working and I'm able to exchange data with a server over the internet.
Specifically the DNS-lookup with getaddrinfo() seems to run into trouble. I also tried to pass an IP-Address to getaddrinfo(). In that case it returns no error, but gives incomplete results (Address correct, but hints about e.g. socktype ignored).
My best guess would be that the nrf_getaddrinfo() implementation is incomplete here. I would be happy about any information about this.
Hello, what is your location? Which ISP are you connecting to?
I'm in Austria and I have a SIM card from T-Mobile. I confirmed that the TCP connection itself is working.
Have you set CONFIG_MQTT_BROKER_HOSTNAME and CONFIG_MQTT_SUB_TOPIC?
I'm using the defaults of the sample. I also tried to set the defaults explicitly, but it makes no difference. The output of the serial port in any case is:
The MQTT simple sample startedLTE Link Connecting ...LTE Link Connected!ERROR: getaddrinfo failed 22ERROR: mqtt_connect -47
I want to emphasize that I'm using the pre-alpha version of the firmware in order to use NB-IoT, which might have an effect on the behavior of the sample. I also want to point out that I use the most recent version of both nrf-zephyr and nrf-connect. As far as I know, I followed every step in the docs published by Nordic for Zephyr.
Is this issue not reproducible on your side? Is there any chance the provider didn't configure their network well enough to work with NB-IoT? Do I have to explicitly specify a DNS server somewhere, or should the prj.conf of the sample work as it is?
ntv1000 said:Is this issue not reproducible on your side?
I tried to reproduce it, but it connected just fine. Try to flash this on your device and see if it works, mqtt_simple_with_secure_boot.hex. I merged the secure_boot and mqtt_simple sample into one hex for sake of convenience, and I'm able to connect with it.