http_client network error on thingy91

Hello,

I am trying to use http requests on Thingy91 and therefore I tried with the sample from zephyr/samples/net/sockets/http_client.

I can build the project without any problem but when I try to run it, I get the following error when I open a putty terminal:

I did not change anything in the code, and I was supposing it was not a network problem since I activated my SIM card and I can run the asset_tracker and see the data in nrFcloud without any issue.

I am using the nrfConnectSDK 2.0.0, and the SIM is from twilio.

Best regards,

C

Parents
  • Hello Carole, 

    rupcar said:
    Also, I had my while() loop because I intent to do a POST request every hour (to a database). What is then the best way to proceed ?

    You probably need to find that out for yourself, as I do not know according to which requirements your application is expected to work. I can only come up with a fairly simple suggestion :-) 

    Once modem is initialised and set to normal mode, it will connect to a carrier and keep that connection until further notice, as long as the requirements to do so are fulfilled.  

    Sockets are operating in a similar way. So, if I would add a while(1) in main, then it would be after the HTTP response was printed and before the clean_up will be performed, in other words here. That way you can always initialise a new send() event, but at a certain point you might want to introduce a semaphore to keep you application in sync. 

    rupcar said:
    But 115 from getAddrInfo() is still there... I am guessing then it is more a network problem? it is, is there a way to choose which network provider's it connects to and see how strong the connection is ?

    I see that you have changed the server from 'example.com' to 'google.com'.  

    #define HTTPS_PORT 443 // https port 
    #define HTTPS_HOSTNAME "google.com"
    #define HTTP_HEAD                                                              \
    	"HEAD / HTTP/1.1\r\n"                                                  \
    	"Host: " HTTPS_HOSTNAME ":443\r\n"                                     \
    	"Connection: close\r\n\r\n"
    #define HTTP_HEAD_LEN (sizeof(HTTP_HEAD) - 1)
    #define HTTP_HDR_END "\r\n\r\n"
    #define RECV_BUF_SIZE 2048
    #define TLS_SEC_TAG 42

    Have you updated the certificate accordingly? 

    Regards, 

    Markus 

  • Hello,

    Thank you for the suggestion!

    I think that the code I sent you was with the wrong certificate but I was trying to connect without it for now anyway. As it was still working half of the time I think it was not the issue for now.

    I don't know how it made the difference but I put the SIM card in my phone to see how the connection on it was, and now when I put it back in the Thingy I don't have the error anymore...

    Carole

Reply Children
No Data
Related