Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COAP file server #367

Closed
awdyice opened this issue Aug 14, 2017 · 5 comments
Closed

COAP file server #367

awdyice opened this issue Aug 14, 2017 · 5 comments
Labels
question Any question about leshan

Comments

@awdyice
Copy link

awdyice commented Aug 14, 2017

Sorry for asking this question that whether you know COAP file server for storing client firmware img?

@sbernard31 sbernard31 added the question Any question about leshan label Aug 16, 2017
@sbernard31
Copy link
Contributor

A production ready CoAP file server, I don't know.
There is a sample in Californium demo-app : https://github.com/eclipse/californium/tree/2.0.x/demo-apps/cf-simplefile-server

But keep in mind that CoAP is not designed for bulk data transfer. Except if you handle really tiny firmware, I advice you to use http/https for firmware transfer.
(See : https://dev.eclipse.org/mhonarc/lists/cf-dev/msg00146.html, https://dev.eclipse.org/mhonarc/lists/cf-dev/msg00142.html)

@boaks
Copy link

boaks commented Aug 23, 2017

Using CoAP blockwise has many flavours and a lot of them smells for trouble :-).
But using it for firmware (e.g. several 100K, but sure not usable for Megabytes) update isn't that bad, if you obey some hints.

  1. pull the firmware from the file-server (write URL to /5/0/1)
  2. don't change the file, add a new file, if a newer firmware should be applied.
  3. take into account, that a blockwise transfer will take some time, there is a lot of latency between the single block transfers. If that's a issue, then go for the advice from simon in the comment before.
  4. take into account, that your client may get interrupted when downloading the firmware (even more, because it will take a few minutes). So a timeout for a single block should usually not finish the transfer complete and you may require an additional "retry/error" mechanism.
  5. even if (very) few downloads may fail, you have a chance to repeat the download later writing again to /5/0/1.

But don't use the californium "transparent blockwise transfer" on your device client to download the firmware, this would not allow to define a proper retry/error mechanism and would require a lot of RAM.

@mdecandia81
Copy link

mdecandia81 commented May 20, 2019

Hi,

Using CoAP blockwise has many flavours and a lot of them smells for trouble :-).
But using it for firmware (e.g. several 100K, but sure not usable for Megabytes) update isn't that bad, if you obey some hints.

  1. pull the firmware from the file-server (write URL to /5/0/1)

regarding this point, the URL has to be an http url (so a coap2http server is needed) or a coap:// url? In the latest case, does leshan server support the file transfer? And where the file should be stored on file system?

Thanks

  1. don't change the file, add a new file, if a newer firmware should be applied.
  2. take into account, that a blockwise transfer will take some time, there is a lot of latency between the single block transfers. If that's a issue, then go for the advice from simon in the comment before.
  3. take into account, that your client may get interrupted when downloading the firmware (even more, because it will take a few minutes). So a timeout for a single block should usually not finish the transfer complete and you may require an additional "retry/error" mechanism.
  4. even if (very) few downloads may fail, you have a chance to repeat the download later writing again to /5/0/1.

But don't use the californium "transparent blockwise transfer" on your device client to download the firmware, this would not allow to define a proper retry/error mechanism and would require a lot of RAM.

@boaks
Copy link

boaks commented May 21, 2019

If your device is able to use http and you want to use if, just use your favourite http-fileserver.
If your device is constrained and therefore may be only able to use coap, you need a coap-fileserver.
A very simple could be found in the demo-apps of californium branch 2.0.x,
cf-simplefile-server.
It's intended for demonstration.

@mdecandia81
Copy link

If your device is able to use http and you want to use if, just use your favourite http-fileserver.
If your device is constrained and therefore may be only able to use coap, you need a coap-fileserver.
A very simple could be found in the demo-apps of californium branch 2.0.x,
cf-simplefile-server.
It's intended for demonstration.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Any question about leshan
Projects
None yet
Development

No branches or pull requests

4 participants