Open lakshT opened 7 years ago
I'm not aware of such a documentation :-).
There are "demo-apps" included, which shows the usage.
I'm trying to implement blockwise transfer from CoAP client to server. In demo apps, I cannot find any example which helps in implementing blockwise transfer. Can you please help?
branch 2.0.x contains a file server, which demonstrates the blockwise transfer. Yo can use the demo client fort hat. There are two modes: californium buffers the data for you (that's then one, the file server uses, and the one I would recommend to start with). In the other one your application provides/gets the data in multiple blocks.
Thanks, I was able to make my blockwise transfer work using the example. Now I encountered another issue. I am sending 100 consecutive requests from client to server using blockwise transfer. Each request carries a payload of approx 2400 bytes. When running the code to send 100 request, after around 40 requests are served. The server sends a null response. When I add a pause delay of 20ms after every request, it works fine. I have no idea what I could be doing wrong or do I have to change some attribute in californium properties in order for my code to work without delay. I would really appreciate any help.
Sounds strange to me. Just to make sure: which branch are you using?
Each request carries a payload of approx 2400 bytes.
As far as RFC7959, 2.2 defines the SZX, 1024 is the largest payload for blockwise. Are you familiar with whireshark? May be it's possible to provide a caputer of your traffic?
I am using branch 2.0.x. By "Each request carries a payload of approx 2400 bytes", I meant that transmission from the client to server has 2400 bytes as total payload to be transfered and as I am using blockwise transfer, I assume that californium would break this for me in multiple requests. Initially I was working in a single computer, client and server in same machine using inter process communication. When I moved to a network environment. It seemed that this problem was fixed.
But now I face another problem. I am trying to transfer large data approx 3MB using californium. Using blockwise transfer here. While sending the data I get the following warning.
WARNING: Possible MID reuse before lifetime end for token [a6], expected MID 18,453 but received 18,452
and then after waiting for a response from the server for sometime, I receive a null response. The server on the other end receives the data being sent but I don't know whats goes wrong while responding. I would really appreciate any help or suggestions.
I'm sorry I don't have a very good understanding of wireshark.
I'm not sure, what your requirements are and if CoAP fulfils them. If your requirement is to transfer frequently 3MB, I would guess, CoAP is the wrong.
WARNING: Possible MID reuse before lifetime end for token [a6], expected MID 18,453 but received 18,452
There are two situation, which may cause this:
So, do you repeat the transfer or do you restart the client?
And have you changed the default configuration? It's usually store in a "Californium.properties".
For blockwise there are three important values:
PREFERRED_BLOCK_SIZE (default 512)
MAX_MESSAGE_SIZE (default 1024)
MAX_RESOURCE_BODY_SIZE (default 2048)
Which values do you use?
The client also uses a request timeout (see CoapClient.setTimeout(long)
). It's important, that this timeout is set to a large enough value for a 3 MB transfer.
I would also strongly advise against using the transparent blockwise handling of Californium for transferring files of that size because Cf will buffer the whole content in memory until the transfer is complete... Use FTP for transferring files, that's what it's made for :-)
I think timeout was causing the issue. I was changing ACK_TIMEOUT property to change the value of timeout. Later I used "CoapClient.setTimeout(long)", which seemed to fix the issue. Thanks for help.
Is there any reason to keep this issue open ?
Californium have any support of throttlling (means per second 10 requests should handle) ?
Californium hasn't a build in throttling. I think, this would depend very much on the use-case. Just as some hints to think on:
In the end it's much easier, to implement that on the application layer. Either by control the request (obey the n-start 1 rule in the client application would be a good point to start), or delaying the response, if that makes sense.
Throttling for server, based on source.
example : per source(ipaddress) per day 200 requests. if requests exeeds 200 drop those requests.
As already written above, that is not implemented.
If you want to implement it on your own, I would recommend that you replace the ServerMessageDeliverer
of the CoapServer
by your own implementation, may be your replacement extends that class and overrides preDeliverRequest
.
While searching I came across --> Tutorial slides --> Master's thesis: Scalability for IoT Cloud Services on http://people.inf.ethz.ch/mkovatsc/californium.php
Is there any other documentation much like a developer manual?