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

getaddrinfo failed 51

I used nrf9160 DK with sim LTE in Vietnam to run mqtt_sample. LTE link successful but I received the ERROR: getaddrinfo fail 51 and mqtt_connect 41. Please help me to solve it. Thanks for your help.

  • Hi! Are you connecting over LTE-M or NB-IoT?

    This file tells you the error message you're getting. 

    #define EAFNOSUPPORT 47 /* Addr family not supported */

    #define ENETUNREACH 51 /* Network is unreachable */

    Could you please add the following config CONFIG_MQTT_LOG_LEVEL_DBG=y to the prj.conf file, and provide a full log file by pressing this button in LTE Link Monitor and attaching the .txt file.

    Best regards,

    Heidi

  • Thank for your help, I did your tutorial but nothing change! Maybe I have to chek my SIM!!!

  • I am also seeing the same issue on a few nrf9160s that I have. Have you found a resolution?

    Something to note was that these nrf9160s were working just fine not too long ago but suddenly stopped working.

    I updated the modem firmware and re-flashed the mqtt_simple example and see a similar output (I also enabled some RTT logging to see what else was happening):

    LTE Link Connecting ...
    [00:10:00.935,882] <inf> lte_lc: Network connection attempt timed out
    [00:10:00.942,382] <inf> lte_lc: Using fallback network mode
    [00:20:00.974,029] <inf> lte_lc: Network connection attempt timed out
    LTE Link Connected!
    ERROR: getaddrinfo failed 51
    ERROR: mqtt_connect -47

Related