nrf9160 HTTPs_CLIENT example not working

Hi,

I'm using nrf9160dk  and i want to run HTTPS_CLIENT example to send some ping.

when i run the HTTPS_CLIENT  I'm getting error:-  "getaddrinfo() failed, err 0" 

i haven't change anything in code expect  HTTPS_HOSTNAME.

please help to clear this Error.

Thanks  

Parents
  • This new error looks related to CA certificate. Your HTTP client cannot use HTTPS without knowing the HTTP server CA certificate. Please look at this case (+) changing certificate in https_client sample - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com) or Modem key management — nRF Connect SDK 2.2.0 documentation (nordicsemi.com) to find your CA certificate for your server domain.

    Best regards,
    Charlie

  • Hi Charlie,

    In previous reply I have already said  our HTTPS end point don't  have any certificates.

    I have to send post request using our HTTPS  endpoint  so I their any example code is available  to send post method using HTTPS endpoint .

    As I said previous reply I have already tired HTTPS_CLIENT example but its not working .I'm requesting you to give some example to do HTTPS post method with out adding any certificates.

    If you need i can send my https endpoint for your reference

    thanks 

  • Hi Bhanu,

    _bhanu said:
    In previous reply I have already said  our HTTPS end point don't  have any certificates.

    Do you mean you are using HTTP without TLS?  then you should with HTTP client AT commands — nRF Connect SDK 2.2.0 documentation (nordicsemi.com).

    nRF9160: HTTPS Client — nRF Connect SDK 2.2.0 documentation (nordicsemi.com) is only designed for HTTPS, try the following modifications if you want to test prue HTTP connection.

    https_client/src/main.c
    ...
    //fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TLS_1_2);
    fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    ...
    //err = tls_setup(fd);

    It would be very helpful if I can test with your HTTPS or HTTP endpoint.

    Best regards,

    Charlie

  • Hi Charlie,

    It would be very helpful if I can test with your HTTPS or HTTP endpoint.

    Below is our https endpoint please check with your end and let me know

    post method example (json formate) :-  {"type":"testing"}

    https://velion-app-staging.herokuapp.com/api/sensor_reading_https/

    thanks 

  • Hi Bhanu,

    Here is the test log with  HTTP client AT commands — nRF Connect SDK 2.2.0 documentation (nordicsemi.com) using HTTP connection for GET and POST commands, both of them work as expected.

    2023-02-10T09:40:21.460Z DEBUG Application data folder: C:\Users\chs1\AppData\Roaming\nrfconnect\pc-nrfconnect-linkmonitor
    2023-02-10T09:40:21.520Z INFO Using nrf-device-lib-js version: 0.4.13
    2023-02-10T09:40:21.521Z INFO Using nrf-device-lib version: 0.12.8
    2023-02-10T09:40:21.521Z INFO Using nrfjprog DLL version: 10.16.0
    2023-02-10T09:40:21.521Z INFO Using JLink version: JLink_V7.80c
    2023-02-10T09:40:21.543Z DEBUG App pc-nrfconnect-linkmonitor v2.0.2 official
    2023-02-10T09:40:21.543Z DEBUG App path: C:\Users\chs1\.nrfconnect-apps\node_modules\pc-nrfconnect-linkmonitor
    2023-02-10T09:40:21.543Z DEBUG nRFConnect 3.12.0, required by the app is (^3.12.0)
    2023-02-10T09:40:21.544Z DEBUG nRFConnect path: C:\Users\chs1\AppData\Local\Programs\nrfconnect\resources\app.asar
    2023-02-10T09:40:21.544Z DEBUG HomeDir: C:\Users\chs1
    2023-02-10T09:40:21.544Z DEBUG TmpDir: C:\Users\chs1\AppData\Local\Temp
    2023-02-10T09:40:21.545Z INFO Installed JLink version does not match the provided version (V7.66a)
    2023-02-10T09:40:23.637Z INFO Modem port is opened
    2023-02-10T09:40:23.646Z DEBUG modem >> AT+CFUN?
    2023-02-10T09:40:23.703Z DEBUG modem << +CFUN: 1
    2023-02-10T09:40:23.705Z DEBUG modem << OK
    2023-02-10T09:40:23.718Z DEBUG modem >> AT+CGSN=1
    2023-02-10T09:40:23.736Z DEBUG modem << +CGSN: "351358815320657"
    2023-02-10T09:40:23.738Z DEBUG modem << 
    2023-02-10T09:40:23.739Z DEBUG modem << OK
    2023-02-10T09:40:23.748Z DEBUG modem >> AT+CGMI
    2023-02-10T09:40:23.765Z DEBUG modem << Nordic Semiconductor ASA
    2023-02-10T09:40:23.767Z DEBUG modem << 
    2023-02-10T09:40:23.768Z DEBUG modem << OK
    2023-02-10T09:40:23.771Z DEBUG modem >> AT+CGMM
    2023-02-10T09:40:23.790Z DEBUG modem << nRF9160-SICA
    2023-02-10T09:40:23.792Z DEBUG modem << OK
    2023-02-10T09:40:23.794Z DEBUG modem >> AT+CGMR
    2023-02-10T09:40:23.812Z DEBUG modem << mfw_nrf9160_1.3.4
    2023-02-10T09:40:23.814Z DEBUG modem << 
    2023-02-10T09:40:23.815Z DEBUG modem << OK
    2023-02-10T09:40:23.816Z INFO Nordic Semiconductor ASA nRF9160-SICA [mfw_nrf9160_1.3.4] SerNr: 351358815320657
    2023-02-10T09:40:23.817Z DEBUG modem >> AT+CEMODE?
    2023-02-10T09:40:23.834Z DEBUG modem << +CEMODE: 2
    2023-02-10T09:40:23.835Z DEBUG modem << OK
    2023-02-10T09:40:23.845Z DEBUG modem >> AT%XCBAND=?
    2023-02-10T09:40:23.866Z DEBUG modem << %XCBAND: (1,2,3,4,5,8,12,13,18,19,20,25,26,28,66)
    2023-02-10T09:40:23.867Z DEBUG modem << OK
    2023-02-10T09:40:23.876Z DEBUG modem >> AT+CMEE?
    2023-02-10T09:40:23.892Z DEBUG modem << +CMEE: 1
    2023-02-10T09:40:23.894Z DEBUG modem << 
    2023-02-10T09:40:23.895Z DEBUG modem << OK
    2023-02-10T09:40:23.898Z DEBUG modem >> AT+CNEC?
    2023-02-10T09:40:23.918Z DEBUG modem << +CNEC: 24
    2023-02-10T09:40:23.929Z DEBUG modem << 
    2023-02-10T09:40:23.930Z DEBUG modem << OK
    2023-02-10T09:40:23.933Z DEBUG modem >> AT+CGEREP?
    2023-02-10T09:40:23.949Z DEBUG modem << +CGEREP: 1,0
    2023-02-10T09:40:23.950Z DEBUG modem << 
    2023-02-10T09:40:23.951Z DEBUG modem << OK
    2023-02-10T09:40:23.954Z DEBUG modem >> AT+CIND=1,1,1
    2023-02-10T09:40:23.996Z DEBUG modem << OK
    2023-02-10T09:40:24.000Z DEBUG modem >> AT+CEREG=5
    2023-02-10T09:40:24.015Z DEBUG modem << OK
    2023-02-10T09:40:24.021Z DEBUG modem >> AT+CEREG?
    2023-02-10T09:40:24.044Z DEBUG modem << +CEREG: 5,1,"7789","031B4300",7,,,"00100001","11000001"
    2023-02-10T09:40:24.048Z DEBUG modem << OK
    2023-02-10T09:40:24.064Z DEBUG modem >> AT+COPS=3,2
    2023-02-10T09:40:24.080Z DEBUG modem << OK
    2023-02-10T09:40:24.085Z DEBUG modem >> AT+COPS?
    2023-02-10T09:40:24.100Z DEBUG modem << +COPS: 0,2,"24201",7
    2023-02-10T09:40:24.103Z DEBUG modem << 
    2023-02-10T09:40:24.104Z DEBUG modem << OK
    2023-02-10T09:40:24.116Z DEBUG modem >> AT%XCBAND
    2023-02-10T09:40:24.133Z DEBUG modem << %XCBAND: 20
    2023-02-10T09:40:24.136Z DEBUG modem << 
    2023-02-10T09:40:24.139Z DEBUG modem << OK
    2023-02-10T09:40:24.148Z DEBUG modem >> AT+CGDCONT?
    2023-02-10T09:40:24.176Z DEBUG modem << +CGDCONT: 0,"IPV4V6","telenor.smart","10.47.69.154 2A02:2121:06B4:0291:0000:0000:4270:B361",0,0
    2023-02-10T09:40:24.177Z DEBUG modem << OK
    2023-02-10T09:40:24.184Z DEBUG modem >> AT+CGACT?
    2023-02-10T09:40:24.200Z DEBUG modem << +CGACT: 0,1
    2023-02-10T09:40:24.201Z DEBUG modem << 
    2023-02-10T09:40:24.204Z DEBUG modem << OK
    2023-02-10T09:40:24.211Z DEBUG modem >> AT%CESQ=1
    2023-02-10T09:40:24.220Z DEBUG modem << OK
    2023-02-10T09:40:24.222Z DEBUG modem >> AT+CESQ
    2023-02-10T09:40:24.231Z DEBUG modem << +CESQ: 99,99,255,255,16,66
    2023-02-10T09:40:24.233Z DEBUG modem << 
    2023-02-10T09:40:24.235Z DEBUG modem << OK
    2023-02-10T09:40:24.244Z DEBUG modem >> AT%XSIM=1
    2023-02-10T09:40:24.252Z DEBUG modem << OK
    2023-02-10T09:40:24.262Z DEBUG modem >> AT%XSIM?
    2023-02-10T09:40:24.277Z DEBUG modem << %XSIM: 1
    2023-02-10T09:40:24.279Z DEBUG modem << OK
    2023-02-10T09:40:24.285Z DEBUG modem >> AT+CPIN?
    2023-02-10T09:40:24.300Z DEBUG modem << +CPIN: READY
    2023-02-10T09:40:24.302Z DEBUG modem << 
    2023-02-10T09:40:24.303Z DEBUG modem << OK
    2023-02-10T09:40:24.310Z DEBUG modem >> AT+CPINR="SIM PIN"
    2023-02-10T09:40:24.333Z DEBUG modem << +CPINR: "SIM PIN",3
    2023-02-10T09:40:24.335Z DEBUG modem << 
    2023-02-10T09:40:24.337Z DEBUG modem << OK
    2023-02-10T09:40:24.346Z DEBUG modem >> AT+CIMI
    2023-02-10T09:40:24.366Z DEBUG modem << 242016001371427
    2023-02-10T09:40:24.369Z DEBUG modem << OK
    2023-02-10T09:40:24.372Z INFO IMSIdentity: 242016001371427
    2023-02-10T09:40:32.664Z DEBUG modem << %CESQ: 255,0,255,0
    2023-02-10T09:40:45.340Z DEBUG modem >> AT#XHTTPCCON?
    2023-02-10T09:40:45.351Z DEBUG modem << #XHTTPCCON: 1,"velion-app-staging.herokuapp.com",80
    2023-02-10T09:40:45.354Z DEBUG modem << OK
    2023-02-10T09:41:03.446Z DEBUG modem >> AT#XHTTPCREQ="GET","/api/sensor_reading_https/"
    2023-02-10T09:41:03.457Z DEBUG modem << OK
    2023-02-10T09:41:03.459Z DEBUG modem << #XHTTPCREQ: -128
    2023-02-10T09:41:03.467Z DEBUG modem << #XHTTPCCON: 0
    2023-02-10T09:41:03.563Z DEBUG modem << %CESQ: 65,3,14,2
    2023-02-10T09:41:03.970Z DEBUG modem << %CESQ: 68,3,19,2
    2023-02-10T09:41:09.490Z DEBUG modem >> AT#XHTTPCCON?
    2023-02-10T09:41:09.504Z DEBUG modem << #XHTTPCCON: 0,"velion-app-staging.herokuapp.com",80
    2023-02-10T09:41:09.505Z DEBUG modem << OK
    2023-02-10T09:41:11.794Z DEBUG modem >> AT#XHTTPCCON=1,"velion-app-staging.herokuapp.com",80
    2023-02-10T09:41:12.322Z DEBUG modem << #XHTTPCCON: 1
    2023-02-10T09:41:12.325Z DEBUG modem << OK
    2023-02-10T09:41:13.398Z DEBUG modem >> AT#XHTTPCCON?
    2023-02-10T09:41:13.410Z DEBUG modem << #XHTTPCCON: 1,"velion-app-staging.herokuapp.com",80
    2023-02-10T09:41:13.412Z DEBUG modem << OK
    2023-02-10T09:41:16.540Z DEBUG modem >> AT#XHTTPCREQ="GET","/api/sensor_reading_https/"
    2023-02-10T09:41:16.551Z DEBUG modem << OK
    2023-02-10T09:41:16.556Z DEBUG modem << #XHTTPCREQ: 0
    2023-02-10T09:41:16.835Z DEBUG modem << HTTP/1.1 200 OK
    2023-02-10T09:41:16.837Z DEBUG modem << Connection: keep-alive
    2023-02-10T09:41:16.838Z DEBUG modem << Server: gunicorn
    2023-02-10T09:41:16.841Z DEBUG modem << Date: Fri, 10 Feb 2023 09:41:16 GMT
    2023-02-10T09:41:16.845Z DEBUG modem << Vary: Accept
    2023-02-10T09:41:16.847Z DEBUG modem << Allow: GET, POST, HEAD, OPTIONS
    2023-02-10T09:41:16.849Z DEBUG modem << X-Frame-Options: DENY
    2023-02-10T09:41:16.850Z DEBUG modem << Content-Length: 0
    2023-02-10T09:41:16.852Z DEBUG modem << X-Content-Type-Options: nosniff
    2023-02-10T09:41:16.854Z DEBUG modem << Referrer-Policy: same-origin
    2023-02-10T09:41:16.858Z DEBUG modem << Cross-Origin-Opener-Policy: same-origin
    2023-02-10T09:41:16.864Z DEBUG modem << Via: 1.1 vegur
    2023-02-10T09:41:16.865Z DEBUG modem << #XHTTPCRSP:0,1
    2023-02-10T09:41:19.205Z DEBUG modem >> AT#XHTTPCCON?
    2023-02-10T09:41:19.216Z DEBUG modem << #XHTTPCCON: 1,"velion-app-staging.herokuapp.com",80
    2023-02-10T09:41:19.218Z DEBUG modem << OK
    2023-02-10T09:41:21.475Z DEBUG modem >> AT#XHTTPCREQ="POST","/api/sensor_reading_https/","","application/json",0
    2023-02-10T09:41:21.490Z DEBUG modem << OK
    2023-02-10T09:41:21.500Z DEBUG modem << #XHTTPCREQ: 0
    2023-02-10T09:41:21.873Z DEBUG modem << HTTP/1.1 200 OK
    2023-02-10T09:41:21.875Z DEBUG modem << Connection: keep-alive
    2023-02-10T09:41:21.876Z DEBUG modem << Server: gunicorn
    2023-02-10T09:41:21.883Z DEBUG modem << Date: Fri, 10 Feb 2023 09:41:21 GMT
    2023-02-10T09:41:21.884Z DEBUG modem << Vary: Accept
    2023-02-10T09:41:21.885Z DEBUG modem << Allow: GET, POST, HEAD, OPTIONS
    2023-02-10T09:41:21.887Z DEBUG modem << X-Frame-Options: DENY
    2023-02-10T09:41:21.890Z DEBUG modem << Content-Length: 0
    2023-02-10T09:41:21.891Z DEBUG modem << X-Content-Type-Options: nosniff
    2023-02-10T09:41:21.893Z DEBUG modem << Referrer-Policy: same-origin
    2023-02-10T09:41:21.900Z DEBUG modem << Cross-Origin-Opener-Policy: same-origin
    2023-02-10T09:41:21.902Z DEBUG modem << Via: 1.1 vegur
    2023-02-10T09:41:21.902Z DEBUG modem << #XHTTPCRSP:0,1
    2023-02-10T09:41:34.029Z DEBUG modem << %CESQ: 65,3,14,2
    2023-02-10T09:41:38.000Z DEBUG modem << %CESQ: 68,3,19,2
    2023-02-10T09:42:09.866Z DEBUG modem << %CESQ: 65,3,14,2
    2023-02-10T09:42:10.000Z DEBUG modem << %CESQ: 68,3,19,2
    2023-02-10T09:42:22.026Z DEBUG modem << %CESQ: 66,3,14,2
    2023-02-10T09:42:22.159Z DEBUG modem << %CESQ: 67,3,19,2
    2023-02-10T09:42:34.829Z DEBUG modem << %CESQ: 65,3,14,2
    2023-02-10T09:43:28.895Z DEBUG modem << %CESQ: 255,0,255,0
    

    Best regards,

    Charlie

  • Hi Charlie,

    i have tried same AT Commands  for HTTP as you send  but we are getting error please go through the below logs for your reference

    [2023-02-10 11:30:23:766_S:] AT
    [2023-02-10 11:30:23:776_R:] OK
    [2023-02-10 11:30:37:509_R:] %CESQ: 34,1,13,1
    [2023-02-10 11:30:47:013_S:] AT+CFUN=1
    [2023-02-10 11:30:47:036_R:] OK
    [2023-02-10 11:30:52:949_S:] AT+CFUN?
    [2023-02-10 11:30:52:962_R:] +CFUN: 1
    [2023-02-10 11:30:52:962_R:] OK
    [2023-02-10 11:30:57:981_R:] %CESQ: 31,1,5,0
    [2023-02-10 11:31:05:659_R:] %CESQ: 35,1,10,1
    [2023-02-10 11:31:28:982_S:] AT+CGSN=1
    [2023-02-10 11:31:28:998_R:] +CGSN: "351358817528042"
    [2023-02-10 11:31:28:998_R:] OK
    [2023-02-10 11:32:02:234_S:] AT+CGMI
    [2023-02-10 11:32:02:248_R:] Nordic Semiconductor ASA
    [2023-02-10 11:32:02:248_R:] OK
    [2023-02-10 11:32:16:346_S:] AT+CGMM
    [2023-02-10 11:32:16:361_R:] nRF9160-SICA
    [2023-02-10 11:32:16:361_R:] OK
    [2023-02-10 11:32:31:090_S:] AT+CGMR
    [2023-02-10 11:32:31:115_R:] mfw_nrf9160_1.3.4
    [2023-02-10 11:32:31:115_R:] OK
    [2023-02-10 11:32:32:708_R:] %CESQ: 35,1,15,2
    [2023-02-10 11:32:48:067_R:] %CESQ: 35,1,10,1
    [2023-02-10 11:32:48:840_S:] AT+CEMODE?
    [2023-02-10 11:32:48:863_R:] +CEMODE: 2
    [2023-02-10 11:32:48:863_R:] OK
    [2023-02-10 11:33:03:425_R:] %CESQ: 30,1,7,1
    [2023-02-10 11:33:04:771_S:] AT%XCBAND=?
    [2023-02-10 11:33:04:795_R:] %XCBAND: (1,2,3,4,5,8,12,13,18,19,20,25,26,28,66)
    [2023-02-10 11:33:04:795_R:] OK
    [2023-02-10 11:33:11:103_R:] %CESQ: 33,1,12,1
    [2023-02-10 11:33:20:829_S:] AT+CMEE?
    [2023-02-10 11:33:20:854_R:] +CMEE: 0
    [2023-02-10 11:33:20:854_R:] OK
    [2023-02-10 11:33:36:641_S:] AT+CNEC?
    [2023-02-10 11:33:36:658_R:] +CNEC: 0
    [2023-02-10 11:33:36:658_R:] OK
    [2023-02-10 11:33:46:956_R:] %CESQ: 30,1,7,1
    [2023-02-10 11:33:50:105_S:] AT+CGEREP?
    [2023-02-10 11:33:50:136_R:] +CGEREP: 0,0
    [2023-02-10 11:33:50:136_R:] OK
    [2023-02-10 11:33:52:064_R:] %CESQ: 35,1,10,1
    [2023-02-10 11:34:03:900_S:] AT+CIND=1,1,1
    [2023-02-10 11:34:03:916_R:] OK
    [2023-02-10 11:34:20:957_S:] AT+CEREG=5
    [2023-02-10 11:34:20:979_R:] OK
    [2023-02-10 11:34:28:526_S:] AT+CEREG?
    [2023-02-10 11:34:28:548_R:] +CEREG: 5,5,"5604","0052C017",7,,,"11100000","11100000"
    [2023-02-10 11:34:28:562_R:] OK
    [2023-02-10 11:34:35:590_R:] %CESQ: 35,1,15,2
    [2023-02-10 11:34:38:137_R:] %CESQ: 33,1,10,1
    [2023-02-10 11:34:45:051_S:] AT+COPS?
    [2023-02-10 11:34:45:068_R:] +COPS: 0,2,"26203",7
    [2023-02-10 11:34:45:068_R:] OK
    [2023-02-10 11:34:56:059_R:] %CESQ: 35,1,15,2
    [2023-02-10 11:35:00:295_S:] AT%XCBAND
    [2023-02-10 11:35:00:313_R:] %XCBAND: 20
    [2023-02-10 11:35:00:313_R:] OK
    [2023-02-10 11:35:12:117_S:] AT+CGDCONT?
    [2023-02-10 11:35:12:135_R:] +CGDCONT: 0,"IP","wlapn.com","10.111.106.73",0,0
    [2023-02-10 11:35:12:151_R:] OK
    [2023-02-10 11:35:24:116_S:] AT+CGACT?
    [2023-02-10 11:35:24:147_R:] +CGACT: 0,1
    [2023-02-10 11:35:24:147_R:] OK
    [2023-02-10 11:35:26:776_R:] %CESQ: 35,1,10,1
    [2023-02-10 11:35:34:052_S:] AT%CESQ=1
    [2023-02-10 11:35:34:073_R:] OK
    [2023-02-10 11:35:45:949_S:] AT+CESQ
    [2023-02-10 11:35:45:973_R:] +CESQ: 99,99,255,255,9,35
    [2023-02-10 11:35:45:973_R:] OK
    [2023-02-10 11:35:59:226_S:] AT%XSIM=1
    [2023-02-10 11:35:59:244_R:] OK
    [2023-02-10 11:36:13:447_S:] AT%XSIM?
    [2023-02-10 11:36:13:471_R:] %XSIM: 1
    [2023-02-10 11:36:13:471_R:] OK
    [2023-02-10 11:36:20:544_R:] %CESQ: 38,1,16,2
    [2023-02-10 11:36:24:404_S:] AT+CPIN?
    [2023-02-10 11:36:24:431_R:] +CPIN: READY
    [2023-02-10 11:36:24:431_R:] OK
    [2023-02-10 11:36:35:902_R:] %CESQ: 38,1,11,1
    [2023-02-10 11:36:36:609_S:] AT+CPINR="SIM PIN"
    [2023-02-10 11:36:36:634_R:] +CPINR: "SIM PIN",3
    [2023-02-10 11:36:36:634_R:] OK
    [2023-02-10 11:36:51:307_S:] AT+CIMI
    [2023-02-10 11:36:51:324_R:] 206018130251423
    [2023-02-10 11:36:51:339_R:] OK
    [2023-02-10 11:37:08:563_S:] AT#XHTTPCCON?
    [2023-02-10 11:37:08:594_R:] ERROR
    [2023-02-10 11:37:40:422_S:] AT#XHTTPCCON=1,"velion-app-staging.herokuapp.com",80
    [2023-02-10 11:37:40:457_R:] ERROR
    


    Please give reply  ASAP  because we are running in a deadline  

    Thanks 

  • Hi Bhanu,

    Could you test with the IP address directly? I suspect your local network operator may not provide DNS service, you need to check with them to confirm.

    Best regards,

    Charlie 

Reply Children
Related