mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andres Quijano" <tulsi...@gmail.com>
Subject Re: Calling prefixedDataAvailable with argument other than 1, 2, or 4
Date Wed, 15 Oct 2008 12:29:34 GMT
errata: prefixedDataAvailable doesn't wait for the bytes, just returns
true if they are present, false if they are not

On Wed, Oct 15, 2008 at 9:28 AM, Andres Quijano <tulsidas@gmail.com> wrote:
> prefixedDataAvailable reads the specified parameter bytes and
> interprets that as a number (which is supposed to be the length of the
> message) then waits until that amount of bytes is available
>
> If you want to decode UDP messages (with this assumed description
> http://www.networksorcery.com/enp/protocol/udp.htm) in your protocol
> you should wait for 6 bytes (source, destination and length) and then
> use prefixedDataAvailable(2) on the buffer, after you skipped the
> first 4 bytes (source and destination)
>
> If you do prefixedDataAvailable(6) (assuming it would work) then MINA
> would read the first 6 bytes, treat that as a number, and wait for
> that amount of bytes to arrive... you can guess it can be a pretty big
> number! (up to 256 terabytes!!)
>
> On Wed, Oct 15, 2008 at 3:15 AM, hezjing <hezjing@gmail.com> wrote:
>> Hi
>> The Javadoc of IoBuffer.prefixedDataAvailable(int prefixLength) explains
>> that
>> the argument prefixLength - the length of the prefix field (1, 2, or 4).
>>
>> Do you know why the argument prefixLength has to be 1, 2 or 4?
>>
>> I want to decode a UDP message which always contains a 6 bytes header.
>> Does it causes any problem when calling prefixedDataAvailable(6)?
>

Mime
View raw message