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

Reply via email to