How to add DTLS to nRF coap client

Hello,

i ran  nRF Coap Client and it worked pretty well.

I am working with nRF9160 DK.

Now, I want to add DTLS to this example to secure the data.

Can someone please help me or is there any tutorials on how to do that?

Best regards,

Cedric

  • The problem appears to be the destination, which is 0.0.0.0. Which server/IP address are you trying to connect to? What is CONFIG_SERVER_ADRESS defined as?

    CONFIG_SERVER_ADRESS is "californium.eclipseprojects.io" and the IP address is 35.185.40.182

  • ced27 said:
    CONFIG_SERVER_ADRESS is "californium.eclipseprojects.io" and the IP address is 35.185.40.182

    In your case, CONFIG_SERVER_ADDRESS has to be the IP address since you can’t use the actual address of the server as an input argument to inet_pton (right now probably the function won’t return 1).

    But anyway, my recommendation would be to use getaddrinfo for CONFIG_SERVER_ADDRESS, as demonstrated in the CoAP Client sample.

    Regards,

    Markus

  • here is what i got:

    2021-10-25T08:20:25.195Z INFO Application data folder: C:\Users\tcheced\AppData\Roaming\nrfconnect\pc-nrfconnect-linkmonitor
    2021-10-25T08:20:25.236Z DEBUG App pc-nrfconnect-linkmonitor v1.1.10 official
    2021-10-25T08:20:25.236Z DEBUG App path: C:\Users\tcheced\.nrfconnect-apps\node_modules\pc-nrfconnect-linkmonitor
    2021-10-25T08:20:25.236Z DEBUG nRFConnect 3.7.1, required by the app is (^3.6.0)
    2021-10-25T08:20:25.236Z DEBUG nRFConnect path: C:\Users\tcheced\AppData\Local\Programs\nrfconnect\resources\app.asar
    2021-10-25T08:20:25.236Z DEBUG HomeDir: C:\Users\tcheced
    2021-10-25T08:20:25.237Z DEBUG TmpDir: C:\Users\tcheced\AppData\Local\Temp
    2021-10-25T08:20:25.248Z VERBOSE Could not fetch serial number for serial port at COM3
    2021-10-25T08:20:27.603Z INFO Modem port is opened
    2021-10-25T08:20:32.404Z DEBUG modem << *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    2021-10-25T08:20:32.433Z DEBUG modem << Startet.....
    2021-10-25T08:20:32.688Z DEBUG modem << PSM-Modus aktiviert
    2021-10-25T08:20:32.693Z DEBUG modem << Verbindung zum LTE-Netz wird hergestellt
    2021-10-25T08:20:32.696Z DEBUG modem << Das kann ein paar Minuten dauern..
    2021-10-25T08:20:32.823Z DEBUG modem << Mit LTE-Netz verbunden
    2021-10-25T08:20:33.994Z DEBUG modem << +CEREG: 2,"63AE","01A3F802",7
    2021-10-25T08:20:34.020Z DEBUG modem << LTE veränderte Zelle: Zelle ID: 27523074, Tracking area: 25518
    2021-10-25T08:20:34.031Z DEBUG modem << Active LTE Modus: LTE-M
    2021-10-25T08:20:34.032Z DEBUG modem << +CSCON: 1
    2021-10-25T08:20:34.035Z DEBUG modem << RRC Modus: verbunden
    2021-10-25T08:20:36.847Z DEBUG modem << +CEREG: 5,"63AE","01A3F802",7,,,"00000000","11100000"
    2021-10-25T08:20:36.856Z DEBUG modem << Netwerkregistrierungsstatus: verbunden mit Roaming
    2021-10-25T08:20:36.864Z DEBUG modem << IPv4 Address found 35.185.40.182
    2021-10-25T08:20:36.868Z DEBUG modem << PSM-Parameter update: TAU: -1, Active time: 0
    2021-10-25T08:20:37.391Z DEBUG modem << Verbindung fehlgeschlagen: error 95
    2021-10-25T08:20:37.396Z DEBUG modem << Keine Verbindung zum Server möglich
    

    Any idea of what the problem may be?

  • ced27 said:
    Any idea of what the problem may be?

    Have you updated the modem and server with a Pre-shared Key (PSK)?

  • Hi Markus,

    i haven't done it from the Californium server side yet. Is there may be any tutorials on how i may it? And eventually how i may run a host on the californium server?

    Any idea will help

    thanks

Related