I have an unfortunate scenario where I am dealing with legacy output peripherals that do not have nicely designed messaging built into them. The messages are variable length, unterminated, with no header information.
So I have encountered a scenario, without a decoder, where the response message (for example) is 70 bytes in length. I've confirmed this with a packet analyzer and it is delivered as a single TCP message. A portion of the message is delivered to the IO handler as a 64 byte buffer where the lim=64 and the cap=64, followed immediately by the remainder of the message in a 6 byte buffer. To handle this situation I've implemented a CumulativeProtocolDecoder that checks to see if the buffer lim = cap in which case I make a big assumption that the message is incomplete, returning for more data. This solves the immediate problem but still has me concerned for a number of reasons. 1. Is MINA buffering splitting the message to fit into buffers. 2. What if the message is exactly the buffer size, my algorithm would cause the message to "hang" so to speak. The question I have, is it possible to find out if more data is available for the session when the lim=capacity just to make sure that the incomplete message assumption is correct? Best Regards Louis
