On 6/15/11 5:14 PM, Luciano Greiner wrote:
Hello.
I wrote a telnet server application using Apache Mina. The clients are
barcode collectors, and the inputs are either a command keys (Ex.: TAB
or F4) or a single char like a number or a letter.$
if you don't do a buffer.get(), the buffer will always contain
something, and will then be read again and again and again.
This part of the code is dubious :
while (buffer.hasRemaining()) {
log.debug("Bytes remaining to proccess: {}", buffer.remaining());
Command command = commandParser.parse(buffer);
if(command != null) {
commandEntered(command);
break;
}
byte data = buffer.get();
...
the break; will exit the while loop whitout consuming a byte in the
bufffer, IMO.
Just check around.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com