On Mon, Feb 16, 2009 at 4:38 PM, Zhijun Sheng <[email protected]> wrote:
>
> Thanks Ashish!  Now I have some directions to think/try. Also I just learnt
> from your comment that IoFilters is lighter-weight than Protocol
> Encoder/Decoder.

It's not about light-weight, You can do the same either ways. Its just
separation of concerns :-)

>
> Sorry I still can't anwser my original question: which one to use?  It
> sounds like pretty hard for me to orgnize these pieces:
>
> We can see 3 data types in 3 layers like this:
>
> IoBuffer -> LowLayerPacket -> HighLayerPacket
>
> IoBuffer <- LowLayerPacket <- HighLayerPacket
>
> Let's assume LowLayerPacket is fixed length 400 bytes with 8 bytes of
> header. HighLayerPacket can be made of any number of LowLayerPackets.
> HighLayerPacket has its own header and tailer.
>
> It'll be great if any one can post some pseudocode to make this task easier
> to understand/implement.

Use Encoders/Decoder

Upon receiving

Wait till 400 bytes are received (Use CumulativeProtocolDecoder)
pass on to next Filter
Next Filter creates High Level Packet by accumulating n Lower Protocol
packets :-)

Do the opposite while sending onto network

Reply via email to