Let's say I have a client that wants to send two large requests to the server (at the same time).
Let's say the first payload is "ABCD" and the second payload is "WXYZ".
First block of first request has messageID=1 and token=0x1 with payload "AB",
First block of second request has messageID=2 and token=0x2 with payload "WX",
Second block of first request has messageID=3 and token=0x3 with payload "CD",
Second block of second request has messageID=4 and token=0x4 with payload "YZ".
You can see where I'm going with this. If messageID and token are different for each request, and they don't follow in consecutive order, how is the server supposed to concatenate the correct blocks?
Here's a sequence diagram:
CLIENT SERVER
| |
| CON [MID=1,TOK=1], POST, /foo, 1:0/1/128, "AB" ------> |
| |
| <------ ACK [MID=1,TOK=1], 2.31 Continue, 1:0/1/128 |
| |
| CON [MID=2,TOK=2], POST, /foo, 1:0/1/128, "WX" ------> |
| |
| <------ ACK [MID=2,TOK=2], 2.31 Continue, 1:0/1/128 |
| |
| CON [MID=3,TOK=3], POST, /foo, 1:1/0/128, "CD" ------> |
| |
| <------ ACK [MID=3,TOK=3], 2.01 Created, 1:1/0/128 |
| |
| CON [MID=4,TOK=4], POST, /foo, 1:1/0/128, "YZ" ------> |
| |
| <------ ACK [MID=4,TOK=4], 2.01 Created, 1:1/0/128 |
The problem occurs on message 3: The server now has two incomplete payloads, how can it reliably map the third request to the correct payload? How does it know that the payload is supposed to be "ABCD" instead of "WXCD"?
The specification for blockwise transfer only states the following:
As a general comment on tokens, there is no other mention of tokens in this document, as block-wise transfers handle tokens like any other CoAP exchange. As usual the client is free to choose tokens for each exchange as it likes.