[zeromq-dev] Difficulty/Confusion in understanding ZMTP

Indradhanush Gupta indradhanush.gupta at gmail.com
Mon Nov 2 18:49:40 CET 2015


Hi,

I'm trying to understand the ZMTP protocol, so I was going through the RFC
for version 1.0 [0]. It states that:

> The following diagram shows the layout of a frame with a length of 1 to
> 254 octets:
>
>             +----------------+
>  Octet 0    | Length         |
>             +----------------+
>  Octet 1    | Flags          |
>             +----------------+- ... ---------------------+
>  Octets 2+  | Body                     Length - 1 octets |
>             +------------------ ... ---------------------+
>
> But, what I don't understand is that if the total length is that of *254
Octets, *and the first and second octets are occupied by the *Length *and
the *Flags *part of the message respectively, how can the *Body *be from *Octet
2 to (Length - 1)* ?  Shouldn't it be *(Length - 2) *, since the first two
octets are occupied already?

The RFC also says that,

For frames with a length of 1 to 254 octets, the length SHOULD BE encoded
> as a single octet.


The length being *1 Octet *itself, can store a max value of *255. *So my
question is, why is the max length of a frame, *254 *and not

*255 ? *
What am I missing here?

[0] - http://rfc.zeromq.org/spec:13

Thanks,
-- 
Indradhanush Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20151102/6a886302/attachment.htm>


More information about the zeromq-dev mailing list