handling received message

This commit is contained in:
lyr90329 2014-07-29 16:19:00 +08:00
parent 45e68c66e6
commit 67e67c68a7
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
package com.myself.server;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
public class MServerHandler extends SimpleChannelUpstreamHandler
{
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) //handling received message
{
if (!(e.getMessage() instanceof NetMsg))
{
return;
}
// Put this Message into queue, and then handle it.
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
{
Channel channel = e.getChannel();
channel.close();
}
@Override
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)throws Exception
{
}
}