[zeromq-dev] Difficulty/Confusion in understanding ZMTP

Pieter Hintjens ph at imatix.com
Mon Nov 2 22:38:57 CET 2015


RFC 13 has some issues; this is one of them. The length includes the
flags field. It's not what you'd expect. We fixed this in RFC 23. If
the length byte is 255, that is used to indicate a long frame, where
the real length is 9 bytes.

-Pieter

On Mon, Nov 2, 2015 at 6:10 PM, Indradhanush Gupta
<indradhanush.gupta at gmail.com> wrote:
> Hi (I already sent this email earlier, but it appears it did not get
> delivered, apologies if you are getting the mail twice)
>
> 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
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list