On Sun, Feb 15, 2009 at 4:22 PM, Zhijun Sheng <[email protected]> wrote:
> Hi, Community,
>
> I'm using mina 2.0.0 M4.  My project requires a 2-layer application protocol 
> implementation.  The relationship between the higher layer and lower layer is 
> a bit like TCP and IP: the higher big packet is split into fix-sized smaller 
> lower layer packets, which the lower protocol is responsible to transmit.  
> The lower layer needs acknowledgement from the other end before sending out 
> next packet.  The lower layer offers transparent service for the higher layer.
>
> What is the recommended way to implement this?  I'm not sure I should use 
> IoFilter or Decoder/Encoder for the lower layer logic.

The use of Protocol Encoder/Decoder is recommended when you want to
change or transform the message, like from byte[] to a high Level
message and vice-versa. Essentially, they also become part of Filter
Chain. So, if you don't want to transform message, IoFilters should be
just fine.
But at the same time I doubt, your implementation shall be so simple.
You have to deal with packet fragmentation/reassembly and other
issues, which shall call for the use of CumulativeProtocolDecode. Well
you may be implementing something similar to Sliding Window protocol,
to increase efficiency of the System.

Hope it helps.

Reply via email to