This is my CoAP Client code for sending requests with incremental payload size:
CoapClient client = new CoapClient(uri);
for (int payloadSize = start; payloadSize <= end; payloadSize += stepSize) {
for (int repeatCount = 0; repeatCount < repeatNo; repeatCount++) {
//building payload
StringBuilder sb = new StringBuilder();
for (int i = 0; i< payloadSize ; i ++)
sb.append("a");
//building request with payload
Request req = new Request(CoAP.Code.GET);
req.setPayload(sb.toString().getBytes());
//sending request
long sendTime = System.currentTimeMillis();
CoapResponse response = client.advanced(req);
long receiveTime = System.currentTimeMillis();
long transmissionTime = receiveTime - sendTime;
...
But, it seems UDP Datagram fragmantation or CoAP block-wise transfer is not happening for the client. What am I doing wrong?
In my local machine, the max payload transferred is about 2300 (less than 2400) bytes. and over internet is about 1400 (less than 1500).
I want to send big requests from the CoAP client to CoAP server. What am I doing wrong? (Specifically to Californium CoAP implementation please.)
Thanks.