users@websocket-spec.java.net

[jsr356-users] Re: [jsr356-experts] Buffer sizes

From: Mark Thomas <mark_at_homeinbox.net>
Date: Tue, 29 Jan 2013 09:23:23 +0000

On 24/01/2013 15:43, Joakim Erdfelt wrote:
> RFC 6455 <https://tools.ietf.org/html/rfc6455> has no limits on Message
> size.
>
> It does however have limits on what a single Frame can be (a Message
> being 1..n frames)
> According to the Section 5.2
> <https://tools.ietf.org/html/rfc6455#section-5.2>: Payload length, a
> Frame can be 71 bits (7+64 bits) in length.
>
> So that means each Frame can be a maximum
> of 2,361,183,241,434,822,606,848 bytes in length.

That is not correct. In the 7+64 bit case the first 7 bits are simply a
flag that the following 8 bytes / 64 bits should read as an unsigned
integer and used as the length. Further, in this case the most
significant bit must be 0 so there are 63 bits for the length making the
maximum length 2^63 - 1 which, not accidentally, is Long.MAX_VALUE.

Mark