Created
April 20, 2014 07:47
-
-
Save GauravBhardwaj/11107910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.netty.channel.Channel; | |
import io.netty.channel.ChannelHandlerContext; | |
import io.netty.channel.SimpleChannelInboundHandler; | |
import io.netty.channel.group.ChannelGroup; | |
import io.netty.channel.group.DefaultChannelGroup; | |
import io.netty.handler.ssl.SslHandler; | |
import io.netty.util.concurrent.Future; | |
import io.netty.util.concurrent.GenericFutureListener; | |
import io.netty.util.concurrent.GlobalEventExecutor; | |
import java.net.InetAddress; | |
/** | |
* Handles a server-side channel. | |
*/ | |
public class ChatServerHandler extends SimpleChannelInboundHandler<String> { | |
@Override | |
public void handlerAdded(ChannelHandlerContext ctx) throws Exception{ | |
//invoked as many times as your client connects | |
} | |
@Override | |
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { | |
ctx.close(); | |
} | |
@Override | |
protected void channelRead0(ChannelHandlerContext ctx, String msg) | |
throws Exception { | |
System.out.println("message recieved is: "+msg.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment