simensrostad / fw-iot-publisher

2 stars 0 forks source link

Connection to CoAP server #1

Open ce237 opened 2 years ago

ce237 commented 2 years ago

Hello,

please can you tell me how you got your connection with the californium server?

Thanks in advance

Cedric

simensrostad commented 2 years ago

The server implementations can be found in this repo, https://github.com/simensrostad/sw-iot-test-servers.

simensrostad commented 2 years ago

But I would suggest running a new version of the californium framework.

ce237 commented 2 years ago

Thanks for your reply.

But I would suggest running a new version of the californium framework.

Do you mean this one : https://github.com/eclipse/californium ?

I am using Intellij to run californium.

Or what do you mean with "new version of the californium framework"?

simensrostad commented 2 years ago

Alright, so you already have an instance running. Then you need to ensure that the correct hostname and DTLS credentials are used.

ce237 commented 2 years ago

And to make sure the correct hostname and DTLS credentials are used, i have to check the server's properties?

or how can i do it?

sorry for too questions

simensrostad commented 2 years ago

I would read up on documentation on the californium framework / the SDK the firmware is based on. Basically you have to identify the hostname on the instance you are running californium on, the IP address and port. Then if you are using DTLS you have to generate certificates and provision them to the device you are running the firmware on.

https://www.eclipse.org/californium/ https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html

ce237 commented 2 years ago

Basically you have to identify the hostname on the instance you are running californium on, the IP address and port.

The instance in this case will be my PC? Since i am running californium using my PC

ce237 commented 2 years ago

Here is my code may be you can please test, if you have time and see if it works for you:

main.zip

simensrostad commented 2 years ago

I'm sorry, but I would encourage you to contact https://devzone.nordicsemi.com/ for issues related to the nRF9160. I don't have time.

ce237 commented 2 years ago

Thanks for your support

ce237 commented 2 years ago

Hi @simensrostad

sorrying for bordering you once again, but i have a question:

How did you initiate a communication with the californium server after your device come out of the PSM (Sleeping mode) in DTLS session?

I will really appreciate having your thoughts on that.

simensrostad commented 2 years ago

It depends. Some networks have really short NAT timeouts. In those cases you will need to perform a new DTLS handshake for every UDP packet transmission, if your packet transmission interval supersedes the NAT timeout.

If you manage to send data within this timeout, you most likely can use the same session key that has already been negotiated with the server during the DTLS handshake. From the fw perspective, you simply continue to push data on the DTLS/UDP socket. PSM shouldn't play a part in this.