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 Reply Children
  • Hello,

    Thanks for the answer.

    Here is when it works:

    2022-07-15T08:03:48.867Z DEBUG modem << Waiting for network.. 
    2022-07-15T08:03:49.875Z DEBUG modem << [00:00:52.217,071] [0m<dbg> lte_lc: init_and_config: The library is already initialized and configured[0m
    2022-07-15T08:07:02.474Z DEBUG modem << [00:04:04.805,206] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 0
    2022-07-15T08:07:02.477Z DEBUG modem << [0m
    2022-07-15T08:07:02.479Z DEBUG modem << [00:04:04.805,328] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 0[0m
    2022-07-15T08:07:02.481Z DEBUG modem << [00:04:04.805,358] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode not found, error code: -22[0m
    2022-07-15T08:07:07.405Z DEBUG modem << [00:04:09.730,438] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 2,"0FC8","0114E209",7
    2022-07-15T08:07:07.414Z DEBUG modem << [0m
    2022-07-15T08:07:07.416Z DEBUG modem << [00:04:09.730,651] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 2[0m
    2022-07-15T08:07:07.417Z DEBUG modem << [00:04:09.730,682] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-15T08:07:07.418Z DEBUG modem << [00:04:09.833,801] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-15T08:07:12.024Z DEBUG modem << OK
    2022-07-15T08:07:13.051Z DEBUG modem << [00:04:15.380,981] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 5,"0FC8","0114E209",7,,,"11100000","11100000"
    2022-07-15T08:07:13.054Z DEBUG modem << [0m
    2022-07-15T08:07:13.056Z DEBUG modem << [00:04:15.381,256] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 5[0m
    2022-07-15T08:07:13.058Z DEBUG modem << [00:04:15.381,286] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-15T08:07:17.367Z DEBUG modem << [00:04:19.683,319] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-15T08:07:17.369Z DEBUG modem << [00:04:19.774,993] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 5,"0FC8","01046C04",7,,,"11100000","11100000"
    2022-07-15T08:07:17.370Z DEBUG modem << [0m
    2022-07-15T08:07:17.378Z DEBUG modem << [00:04:19.775,238] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 5[0m
    2022-07-15T08:07:17.380Z DEBUG modem << [00:04:19.775,268] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-15T08:07:17.381Z DEBUG modem << [00:04:20.294,799] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-15T08:07:17.570Z DEBUG modem << Connecting to google.com
    2022-07-15T08:07:17.859Z DEBUG modem << Sent 60 bytes
    2022-07-15T08:07:18.227Z DEBUG modem << bytes are 0 
    2022-07-15T08:07:18.232Z DEBUG modem << Received 0 bytes
    2022-07-15T08:07:18.234Z DEBUG modem << Finished, closing socket.

    And here is what I get when it does not work with error 115:

    2022-07-15T08:03:07.244Z DEBUG modem << Waiting for network.. 
    2022-07-15T08:03:08.254Z DEBUG modem << [00:00:10.595,550] [0m<dbg> lte_lc: init_and_config: System mode (1) and preference (0) are already configured[0m
    2022-07-15T08:03:41.923Z DEBUG modem << [00:00:44.243,011] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 2,"0FC8","0114E209",7
    2022-07-15T08:03:41.927Z DEBUG modem << [0m
    2022-07-15T08:03:41.930Z DEBUG modem << [00:00:44.243,225] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 2[0m
    2022-07-15T08:03:41.931Z DEBUG modem << [00:00:44.243,255] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-15T08:03:41.932Z DEBUG modem << [00:00:44.338,775] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-15T08:03:45.005Z DEBUG modem << OK
    2022-07-15T08:03:46.055Z DEBUG modem << [00:00:48.357,788] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 5,"0FC8","0114E209",7,,,"11100000","11100000"
    2022-07-15T08:03:46.057Z DEBUG modem << [0m
    2022-07-15T08:03:46.064Z DEBUG modem << [00:00:48.358,032] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 5[0m
    2022-07-15T08:03:46.066Z DEBUG modem << [00:00:48.358,062] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-15T08:03:46.071Z DEBUG modem << [00:00:48.414,428] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 2,"0FC8","0114E209",7
    2022-07-15T08:03:46.072Z DEBUG modem << [0m
    2022-07-15T08:03:46.076Z DEBUG modem << [00:00:48.414,611] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 2[0m
    2022-07-15T08:03:46.077Z DEBUG modem << [00:00:48.414,642] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-15T08:03:47.435Z DEBUG modem << [00:00:49.755,401] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-15T08:03:47.438Z DEBUG modem << [00:00:49.864,868] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 2
    2022-07-15T08:03:47.441Z DEBUG modem << [0m
    2022-07-15T08:03:47.444Z DEBUG modem << [00:00:49.864,990] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 2[0m
    2022-07-15T08:03:47.445Z DEBUG modem << [00:00:49.865,020] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode not found, error code: -22[0m
    2022-07-15T08:03:48.759Z DEBUG modem << getaddrinfo() failed, err 115

    And here with error 116:

    2022-07-15T08:25:01.226Z DEBUG modem << Waiting for network.. 
    2022-07-15T08:25:01.854Z DEBUG modem << [00:22:04.205,078] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-15T08:25:01.858Z DEBUG modem << [00:22:04.205,261] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 0
    2022-07-15T08:25:01.861Z DEBUG modem << [0m
    2022-07-15T08:25:01.864Z DEBUG modem << [00:22:04.205,383] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 0[0m
    2022-07-15T08:25:01.869Z DEBUG modem << [00:22:04.205,383] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode not found, error code: -22[0m
    2022-07-15T08:25:01.871Z DEBUG modem << [00:22:04.605,346] [0m<dbg> lte_lc: init_and_config: The library is already initialized and configured[0m
    2022-07-15T08:26:13.851Z DEBUG modem << [00:23:16.201,904] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 2,"0FC8","0114E209",7
    2022-07-15T08:26:13.854Z DEBUG modem << [0m
    2022-07-15T08:26:13.860Z DEBUG modem << [00:23:16.202,117] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 2[0m
    2022-07-15T08:26:13.862Z DEBUG modem << [00:23:16.202,148] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-15T08:26:13.866Z DEBUG modem << [00:23:16.300,689] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-15T08:26:17.076Z DEBUG modem << OK
    2022-07-15T08:26:17.078Z DEBUG modem << Connecting to google.com
    2022-07-15T08:26:17.785Z DEBUG modem << connect() failed, err: 116

    I am not really familiar with all that, and did not find much help online.It seems like it might be an unstable connection during the call to getAddrInfo() but what I don't really get is why it is still working half of the time.I'm using a Twilio SIM in Switzerland and I though it was supposed to have great connection.

    I know I am also having a 0 answer from recv() which I'm still trying to figure out but I'm not sure it is coming from this since it works some of the time.

    Thanks!

    Carole

Related