โ† Back to the chapter

Technical detail ยท CoAP Block and Discovery Contracts

CoAP Block1 size changes and upload response codes

A CoAP Block1 upload splits request data into numbered pieces sent to a server over UDP (User Datagram Protocol).

NUM is the block number, SZX encodes its payload size, and M is the More flag: 1 means more data blocks follow and 0 marks the final data block. Block2 instead divides response data returned by the server.

For ordinary UDP blocks, SZX values 0 through 6 select sizes from 16 through 1,024 bytes using 2^(SZX + 4). A smaller size may be negotiated for buffer or path limits. Recalculate NUM from the required byte position when size changes: keeping the old number points to different bytes.

An 18,432-byte Block1 log upload with SZX 4 uses 256-byte blocks and needs 72 full blocks. NUM 31 starts at 7,936 with M 1. NUM 71 starts at 18,176 and carries the final 256 bytes with M 0.

2.31 Continue asks for further request data; it does not prove final application acceptance. Check the final operation response, such as 2.01 Created or 2.04 Changed. An incomplete request can produce 4.08 Request Entity Incomplete; an oversized request can produce 4.13 Request Entity Too Large, possibly with a smaller size hint. Specify upload identity and commit behavior separately from download continuity.

โ† Back to the chapter