I found some code on this link http://www.techbrainwave.com/?p=912 which describes how to set up a client server architecture using apache mina. However, in the example provided it is only one-way communication (from client to server). Does anyone know how to modify this in order to obtain two-way communication?
If you want the server to reply to the client message, you need to do it in the IoHandler of the server :
@Override
public void messageReceived(IoSession session, Object message)
{
logger.info("Message received in the server..");
logger.info("Message is: " + message.toString());
// reply to the client
session.write( /*the reply message here */);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With