Wow, this is really bad behaviour on the part of MINA. What were the developers thinking? As for having a CumulativeProtocolDecoder, this is always a good practice as you just can't predict what TCP/IP will do with packets. The best way to treat incoming TCP/IP data is as a stream. When implementing something like a CumulativeProtocolDecoder, bear in mind that one of MINA's gotchas is that you can only have one ProtocolCodecFilter per filter chain. So you will need to implement your own IoFilter to do this. Dividing an incoming stream into discrete messages is such a common requirement that some sort of framework for it should exist in MINA 2.0. Here's hoping.
- Steve pingvishal wrote: > > Hi, > its for every new message received (ignore my prev mail .. i did some > check to post this again) .. > however, whats happening is .. the server has dispatched the entire packet > and i dont receive it that way .. (the packet sizes are really small .. > abt 200 bytes .. and the ByteBuffer capacity goes down to 64 bytes :| ) > > how should i be tackling this ? store all the incoming chunks in my own > object (CumulativeProctocolDecoder) or is there a better way ? > > vishal > > > Trustin Lee wrote: >> >> On 10/12/07, pingvishal <[EMAIL PROTECTED]> wrote: >>> >>> Hello All, >>> >>> am facing this strange issue of the socket's receiving Bytebuffer >>> capacity >>> reducing into half (start from 4096) with every new connection .. >>> i have a SocketConnector and am using a ProtocolCodec (tried using a >>> CumulativeProtocolDecoder but with same result). >>> what am i missing and Is there any way i can handle this in my program ? >> >> With every new connection? You mean with every new message? If it >> decreases for every new connection, it's a bug. However, if it's for >> every new message received, it's a normal behavior. MINA >> automatically adjusts the buffer capacity per read, and the capacity >> will decrease to the half if the amount of bytes received is too >> small. Please clarify if it's for every new connection or message. >> >> Trustin >> -- >> what we call human nature is actually human habit >> -- >> http://gleamynode.net/ >> -- >> PGP Key ID: 0x0255ECA6 >> >> > > -- View this message in context: http://www.nabble.com/ByteBuffer-capacity-shrinks-tf4612562s16868.html#a13197657 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
