Lorenzo thanks a lot for the reply - actually this mail somehow ended up in my spam folder so did not see it earlier (before replying to Emanuel). Let me try this - but still have a hunch that I am missing something :)
Thanks, Shubhankar -----Original Message----- From: Lorenzo Bolzani [mailto:[email protected]] Sent: Saturday, June 20, 2009 2:39 AM To: [email protected] Subject: Re: Handling variable length request/response in MINA 2009/6/20 Chowdhury, Shubhankar [WHQKA] <[email protected]>: > > The application would be a server listening to a port (TCP) and also > would return back some response based on the type field. So the client > would initiate by sending a "login-request" - in response we have to > send "accept" or "reject", then the data would be flowing, then log-out, > keep-alive etc and all of them would follow the above structure. Hi, check this article http://mina.apache.org/tutorial-on-protocolcodecfilter-for-mina-2x.html The code should be something like this if (buffer.available() < headerLength) { return false; //wait for header } // read header with data length if (buffer.available() < dataLength) { return false; //wait for data } // read all data session.write(msg); return true; Bye Lorenzo
