I am creating my own flash game server in netty. I'm using flash policy server in the port 843 and game server port in the 8080... Also, I'm using zerodelimeter for framer; however, when i receiving messages on the flash client, i got two messages instead of one message. First message is the real message that i should get; however, the second one is the empty message. How can i avoid the second message receiving in the netty side?
Thanks,
In the below, you can look at the my ChannelPipelineFactory...
public class SocketServerPipelineFactory implements ChannelPipelineFactory {
public ChannelPipeline getPipeline() throws Exception {
PlayerController controller = PlayerController.createPlayerController();
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192,
zeroDelimiter()));
pipeline.addLast("decoder", new StringDecoder(CharsetUtil.UTF_8));
pipeline.addLast("encoder", new StringEncoder(CharsetUtil.UTF_8));
pipeline.addLast("handler", new SocketServerHandler(controller));
return pipeline;
}
public static ChannelBuffer[] zeroDelimiter() {
return new ChannelBuffer[] { ChannelBuffers.wrappedBuffer(new byte[] { '\0' }),
ChannelBuffers.wrappedBuffer(new byte[] { '\r', '\n' }) };
}
}