On 4/28/11 8:14 AM, Abhishek Chavan wrote:
Hi All,
I am using Apache Mina to create a server to accept UDP Client requests. I
have read the Official documentation provided by Apache Mina regarding UDP
Server<http://mina.apache.org/udp-tutorial.html> & UDP Client. However, I
wished to know when the server receives a message, can I write back to the
UDP Client using the same session(I know UDP is connectionless at Network
Layer, however I can get the IP and PORT of the remote host at Application
Layer) such that UDP Client receives a message. I know this is possible is
TCP but am a little confused about UDP. I know this may not exactly be Java
based but more Network Layer based question. Would appreciate if somebody
could clear this for me.
Simply write into the session in your server handler messageReceived()
method. The response will be propagated to your client.
public void messageReceived(IoSession session, Object message)
throws Exception {
session.write( <response> );
}
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com