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

9160DK: http_client sample connect() failed with error 60

Hi Support Team

     I try to run the http_client sample based on ncs1.2.0,  and I use the following configs because only NB-Iot available in our location: 

     

CONFIG_BSD_LIBRARY=y
CONFIG_BSD_LIBRARY_SYS_INIT=n

CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_NATIVE=n

CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_MAIN_STACK_SIZE=4096

CONFIG_MODEM_KEY_MGMT=y
CONFIG_LTE_LINK_CONTROL=y

CONFIG_LTE_NETWORK_MODE_NBIOT=y
CONFIG_LTE_LEGACY_PCO_MODE=y
CONFIG_LTE_PSM_REQ_RPTAU="00000110"
CONFIG_LTE_PSM_REQ_RAT="00000000"

     when start running the sample, the terminal prints as:

     

*** Booting Zephyr OS build v2.1.99-ncs1  ***
HTTPS client sample started
Provisioning certificate
Waiting for network.. OK
Connecting to google.com
connect() failed, err: 60

     I try to find solutions from devzone; and find this tickets: 

https://devzone.nordicsemi.com/f/nordic-q-a/58556/basic-http-get-example/237525#237525, according to the suggestions in the ticket, I try to use "216.58.208.174" replace "google.com" but it didn't work(  I think it's not the root cause for my case, for my getaddinfo() is always ok   ); I also tested the mqtt_simple demo, whether use the defalut code directly or add the configure 'CONFIG_MQTT_BROKER_HOSTNAME="137.135.83.217"', the sample can runs well...

     So I still have no idea to deal with the "connect error 60" of the http_client sample. Can you give some suggestions?

    

BR

Smile

   

  • Hi!

    As Håkon states in the ticket you linked to: 

    The behavior you see is highly likely inherited from the network that you are connecting to.

    Have you tested if TCP works at all in your current network?

    Did you try mqtt_simple, where you set the IP manually in prj.conf? mqtt.eclipse.org currently resolves to 137.135.83.217, so that would be:

    CONFIG_MQTT_BROKER_HOSTNAME="137.135.83.217"

     

    If that fails, try an UDP based sample, like this one (change define NTP_HOST to 129.240.2.6):

    https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/ntp/src/main.c

    Did you do this? 

    Best regards,

    Heidi

  • Hi Heidi

       I tried the MQTT_Simple sample and made some configurations in prj.conf adapted for NB-Iot network, The MQTT_Simple sample always runs well and no need extra modifications in the code.

       About the HTTPS_CLIENT sample, I guess its because I 'm in China-mainland and have no access to google.com without VPN.

      So I tried to connect www.bing.com with its cerification, it works well finally. like :

      

    *** Booting Zephyr OS build v2.1.99-ncs1  ***
    HTTPS client sample started
    Provisioning certificateWaiting for network.. OK
    Connecting to bing.com
    Sent 62 bytes
    Received 810 bytes
    > HTTP/1.1 302 Found
    Finished, closing socket.

    So I think I solved the problem.

    Thanks for your help.

    BR

    Smile

Related