Yogs wrote: > Hi > > I have a blocking client connected to a MINA based server. And client is > sending variable length message to server. The Message doesn’t have a notion > of msgLength. So in my decoder.docodable() method can’t figure out whether > this message is complete or not. So when I actually decode the message, I > get BufferUnderFlowException in decode() method. I can calculate the > length of message in decodable method, but for that I need to read the > complete message. This can be multiple times till message arrives > completely. and then i can actual decode the message in decode method. This > is a huge overhead of reading the message multiple times. > I really don’t want to pass an extra msgLenght field in the message to solve > this problem, because of compatibility issues with non java clients. > > Can you please suggest a way which MINA provides to deal with decoding of > these types of variable length messages on servers? > > I think CumulativeProtocolDecoder could be what you are looking for. Have a look at the Javadoc for an example of how to use it with CRLF terminated string messages.
-- Niklas Therning www.spamdrain.net