mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hezjing <hezj...@gmail.com>
Subject How to check UDP message header length?
Date Fri, 09 Jan 2009 07:22:17 GMT
I'm trying to implement an UDP message that has a fixed 6 byte of header,
where the 3rd and 4th byte are the size of the message payload.

CumulativeProtocolDecoder is the choice since the header's size fixed, and
there is a payload length information (correct?).
I will have to first read the 6 bytes header, and continue to read the
subsequent bytes as specified by the payload size.

For example, the following is the IoBuffer printed in doDecode():

HeapBuffer[pos=0 lim=20 cap=20: 0E 01 00 00 00 DB 00 00 00 00 00 00 00 00 00

The IoBuffer has the limit() , capacity()  and remaining() of 20 bytes.

The question is, how do we know the header is ready to be parsed?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message