Subject: [core] option lenght problem

From: "[email-masked]" <[email-masked]>
Date: Sat, 18 Dec 2010 18:17:43 +0100 (CET)

hy to all,
i need an help for the implemtation of the coap, in particularly the lenght of 
the option code is 4 bit for the code and other 4 bit for the lenght of the 
option value( 1byte in total), now if the lenght of the option value is more 
than 15 we need to add another byte so in total 16(bit)[short] so i need to 
know: 
if a client sent a short how can a server know if it is a short or a byte?

example

client sent  an option value with the lenght of 20

+---+---+---+---+---+---+---+---+---+---
| option delta | 1 0100 | length > 15 |
+---+---+---+---+---+---+---+---+---+---

now i cant represent 20  with 4 bit i need to add other 8 bit, now the option 
delta and the lenght as to become a short so that i can represent 20,
i want to know how the server knows when a client are sending a short?
i hope someone can help
bye thanks

---

From: Carsten Bormann <[email-masked]>
Date: Sun, 19 Dec 2010 21:47:41 +0100

Hi,

Section 3.2 of coap-03 says:

   Each option has the following format:

         0   1   2   3   4   5   6   7
       +---+---+---+---+---+---+---+---+
       | option delta  |    length     | for 0..14
       +---+---+---+---+---+---+---+---+
                                                  for 15..270:
       +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
       | option delta  | 1   1   1   1 |          length - 15          |
       +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

                      Figure 6: Header option format

So to send an option with length of 20, send

       +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
       | option delta  | 1   1   1   1 |          20 - 15 = 5          |
       +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

The receiver can recognize the extended format by the presence of the number 15 (0b1111) in the second nibble.

Gruesse, Carsten

---

From: Kepeng Li <[email-masked]>
Date: Mon, 20 Dec 2010 09:04:31 +0800

Hi all,

I want to get a help to know that, in a Put/Post, do we need to negotiate
the block size (SZX)? 

I notice that in the spec, only Get is mentioned, but there is no text about
Put/Post.

>> To influence the block size used in response to a GET request, the
requestor uses the Block option, giving the desired size, a block   number
of zero and an M bit of zero.

Thanks,
Kind Regards
Kepeng