CoAP quick start example
The following diagram shows the message format for the CoAP protocol; see ISSN: 2070-1721 for details:
This is an example GET request:
44 01 C4 09 74 65 73 74 B7 65 78 61 6D 70 6C 65
The following table describes the fields in the GET request.
Field | HEX | Bits | Meaning |
---|---|---|---|
Ver | 44 | 01 | Version 01, which is mandatory here. |
T | 00 | Type 0: confirmable. | |
TKL | 0100 | Token length: 4. | |
Code | 01 | 000 00001 | Code: 0.01, which indicates the GET method. |
Message ID | C4 09 | 2 Bytes equal to hex at left | Message ID. The response message will have the same ID. This can help out identification. |
Token | 74 65 73 74 | 4 Bytes equal to hex at left | Token. The response message will have the same token. This can help out identification. |
Option delta | B7 | 1011 | Delta option: 11 indicates the option data is Uri-Path. |
Option length | 0111 | Delta length: 7 indicates there are 7 bytes of data following as a part of this delta option. | |
Option value | 65 78 61 6D 70 6C 65 | 7 Bytes equal to hex at left | Example. |