Pick direction
Block1 is for a large request payload, such as PUT firmware. Block2 is for a large response payload, such as GET configuration.
Animate RFC 7959 Block1 and Block2 transfers, block fields, retries, size negotiation, and completion rules.
Break a large request or response body into CoAP blocks. Step through each request and response, inspect the NUM/M/SZX option fields, test server size negotiation, and see why smaller blocks trade throughput for recoverability on constrained links.
Block1 is for a large request payload, such as PUT firmware. Block2 is for a large response payload, such as GET configuration.
SZX encodes 16 to 1024 byte blocks using 2^(SZX+4). Smaller blocks retry cheaply but need more exchanges.
The transfer continues while M=1. The final block has M=0; do not rely only on a size estimate.
Block1 uses 2.31 Continue until the final block. Block2 returns 2.05 Content blocks requested by the client.
A client retrieves a large resource from a constrained server in Block2 response chunks.
Zero-based block number.
0One means more blocks follow.
1, moreBlock size exponent.
4 -> 256 BPayload span in this block.
0-255Use Step to watch the first request/response exchange. The option readout uses the RFC shorthand Block2 NUM/M/size.
| Question | Fast answer | Why it matters | Watch out |
|---|---|---|---|
| Which option do I use? | Block1 for request payloads, Block2 for response payloads. | It tells you whether the big body is travelling client-to-server or server-to-client. | Both options can appear in both message directions, but each pertains to its own payload direction. |
| How is block size encoded? | size = 2^(SZX+4), with SZX 0 to 6 for 16 to 1024 bytes. |
Receivers can negotiate a smaller block that fits their memory and link constraints. | Larger blocks reduce exchanges but make each loss more expensive. |
| When is transfer complete? | The final block has M=0. |
The M bit is the completion signal for this transfer. | Size1/Size2 are estimates or hints; the end is governed by the M bit. |
| What happens on Block1 upload? | Non-final blocks normally receive 2.31 Continue; the final block gets success or an error. |
The server can assemble or stream request body blocks before applying the change. | Missing earlier blocks can produce 4.08 Request Entity Incomplete. |
| What happens on Block2 download? | The client requests each NUM and the server returns 2.05 Content with payload. |
The client reassembles the response representation one block at a time. | Dynamic resources should use ETag checks if consistency matters. |
The compact integer is (NUM << 4) + (M << 3) + SZX. This workbench displays the human-readable shorthand NUM/M/size.
Use for PUT or POST request bodies that are too large for one message. The final block is where an atomic create or replace normally takes effect.
Use for a large response body. The first GET can include a preferred Block2 size; follow-up GETs ask for later block numbers.
Keep the default configuration download, click Step twice, and compare the request option with the response option. The request asks for a block; the response says whether more blocks follow.
Change 256 B to 64 B, then watch block count rise. This is useful when links are lossy or buffers are small, but it increases request/response overhead.
Select the capacity scenario. The server accepts a smaller maximum, so the client must adapt to the lower SZX instead of insisting on its original block size.
This is a teaching model for payload splitting and message sequence. It does not attempt to calculate exact link-layer airtime, DTLS overhead, OSCORE overhead, or implementation-specific buffering.
The lost-response path uses CoAP Confirmable message behavior from RFC 7252. It shows a retry of the same block exchange, not a new transfer of the entire body.
Size1 and Size2 can communicate body-size estimates, but they do not by themselves end the transfer. The workbench uses the M bit as the transfer-completion rule.