This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using getaddrinfo for DNS-Lookups (nrf9160 DK)

Hello!

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.

Parents Reply
  • Running this example yields the expected output.

    [2019-03-19 14:18:26.218] ***** Booting Zephyr OS v1.13.99-ncs1-4741-g1d6219ffec *****
    [2019-03-19 14:19:10.756] FTP example
    recv_buf:19 14:19:10.757]
    User-agent: *4:19:13.182]
    [2019-03-19 14:19:13.183] Disallow: /
    [2019-03-19 14:19:13.184]
    [2019-03-19 14:19:13.185]

    So the socket connections in general work. There just seems to be a problem with getaddrinfo().

    In case the provider didn't properly setup DNS autoconfiguration on their side, is there maybe a way to configure a DNS server on my side?

Children
Related