Hi everyone.I'am now trying to develop a emulator for a game called "SoulWorker".
And it is my very first time to develop a emulator,so,I got a problem.
I'm using Netty as my framework.
I create a login server as the following
And here is my handler:
So the problem is,after I launched my client.
the string "connected" is able to print to my console but,
I CAN NOT read anything.
String "reading" is never been printed to my console.
plz help me.
Ok I know my client isn't sent anything to server.
I don't know why but I guess if login info wasn't there the client would not send anything to server
And it is my very first time to develop a emulator,so,I got a problem.
I'm using Netty as my framework.
I create a login server as the following
Code:
EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGroup = new NioEventLoopGroup();
ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new DiscardServerHandler()); } }).option(ChannelOption.SO_BACKLOG, 128) .childOption(ChannelOption.SO_KEEPALIVE, true) .childOption(ChannelOption.TCP_NODELAY, true); ChannelFuture f = b.bind(LOGIN_SERVER_PORT).sync(); f.channel().closeFuture().sync();
And here is my handler:
Code:
public class DiscardServerHandler extends ChannelInboundHandlerAdapter { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { // TODO Auto-generated method stub System.out.println("connected"); super.channelActive(ctx); } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { // (2) System.out.println("reading"); if (!(msg instanceof ByteBuf)) return; try { System.out.println("read...."); } finally { ReferenceCountUtil.release(msg); } }
}
So the problem is,after I launched my client.
the string "connected" is able to print to my console but,
I CAN NOT read anything.
String "reading" is never been printed to my console.
plz help me.
Ok I know my client isn't sent anything to server.
I don't know why but I guess if login info wasn't there the client would not send anything to server