Closed Woguagua closed 1 month ago
RFC 7252, 3.2 Option Value Formats
uint: ...
For example, the number 0 is
represented with an empty option value (a zero-length
sequence of bytes)
@Woguagua
As the RFC7252 defines, the option value should be 0 for "text/plain", not empty.
As in my comment, RFC 7252 explicitly defines, that the value 0 is an empty option value. Therefore the encoding used by Californium complies with the spec. If you've implemented your server on your own, maybe you adapt it. If it's a product or project of someone else, maybe you forward this information to them,
I am using Californium to build a CoAP client in my computer. And I use the API Californium provided as follows:
CoapResponse response = client.post(payload, MediaTypeRegistry.TEXT_PLAIN);
However, when I receive this request and decode it with my server built by my own application, I find that the option length of the option "Content-Format" is 0, and the corresponding option value is empty. As the RFC7252 defines, the option value should be 0 for "text/plain", not empty.