Subject: [core] Block Transfer issue

From: Sharad Holani <[email-masked]>
Date: Fri, 23 Jan 2015 09:24:17 +0000 (GMT)

Its Sharad.

If the size of CoAP Request message header is 100 bytes and  the maximum block size allowed is 64 bytes then how do we send the request ?
Let the size of the payload of this request be 50 bytes.
And the SZX field stores the size of the entire block or only the size of the payload? Payload length field is there for this reason , right?

So now if we have to send this request block wise then what will be the message flow?

In my implementation , I have considered the entire message (header + payload) as a payload and have added a new header with relevant
fields only (token , message id , Block option).
I am attaching this header to every block. I am also handling these messages in this way.

Example -

A POST CoAP request has a header of size 50 bytes and payload of 50 bytes.
Maximum block size is 64 bytes.

This is the message flow which I understood from the replies -

Client               Server
1) ---------->
POST Request
Header - 50 bytes
Payload size - 14 bytes

2) ---------->
POST Request
Header - 50 bytes
Payload size - 14 bytes

3) ---------->
POST Request
Header - 50 bytes
Payload size - 14 bytes

4) ---------->
POST Request
Header - 50 bytes
Payload size - 8 bytes

What will the case if the size of CoAP header itself is say 100 bytes?

And this is the flow which I have implemented -:

New Payload = ( size of header + size of payload) = 50 + 50 = 100 bytes.
I am adding a header on top of this of size say 40 bytes to every block which will contain only relevant fields needed to parse this block message on the other side.

Client               Server
1) ---------->
POST Request
Header - 40 bytes
Payload size - 24 bytes

2) ---------->
POST Request
Header - 400 bytes
Payload size - 24 bytes

3) ---------->
POST Request
Header - 40 bytes
Payload size - 24 bytes

4) ---------->
POST Request
Header - 40 bytes
Payload size - 24 bytes

5) ---------->
POST Request
Header - 40 bytes
Payload size - 4 bytes

On the receiving side i strip this header (40 bytes) and concat the payload , and in the end I convert I convert it back to the CoAP message.

I have omitted the acknowledgement message sent by server for each block message received.

---

From: Olaf Bergmann <[email-masked]>
Date: Fri, 23 Jan 2015 11:27:06 +0100

Sharad,

Sharad Holani <[email-masked]> writes:

> If the size of CoAP Request message header is 100 bytes and the
> maximum block size allowed is 64 bytes then how do we send the request
> ?

you must not subtract the CoAP message header size from the block
size. If you have 100 bytes data to send, and your block size is set to
64 bytes, you send two messages: The first contains 64 bytes of your
data, the second has 100-64 = 36 bytes of data (the payload length would
be 64 for the first message, 36 for the second). The CoAP message
header's size does not matter.

Grüße
Olaf