Reputation: 31
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?
Upvotes: 3
Views: 2706
Reputation: 3033
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 */);
}
Upvotes: 5