Search code examples
httpcoap

Is it possible to transfer a file through CoAP?


Recently, I am doing a project and I am trying to transfer a json file to the CoAP server. I put some random values in key:value pairs such as:

{
    key1: value1,
    key2: [value21, value22, value23]
}

Questions:

  • CoAP is pretty much similar to HTTP. So, like HTTP, is it possible to transfer a json file through CoAP using POST/PUT method? If it is possible, what is the recommended directory location to put the uploaded file into the server (resource directory)?

Update:

The actual file size is about to 152.8 kB.


Solution

  • You can transfer arbitary JSON files using CoAP POST/PUT. Which directory would be writable depends fully on the server.

    Note that for a file of that size, transfer times would be considerably longer than with HTTP, as packages are sent in lock-step (putting the first 1kB, response, next 1kB – whereas HTTP has a TCP window).