netty에 내 플래시 게임 서버를 만들고 있습니다. 나는 8480 포트의 플래시 정책 서버와 8080의 게임 서버 포트를 사용하고 있습니다 ... 또한 프레이머에 0 리미터를 사용하고 있습니다. 그러나, 내가 플래시 클라이언트에서 메시지를받을 때, 나는 하나의 메시지 대신에 두 개의 메시지를 얻었다. 첫 번째 메시지는 내가 받아야 할 실제 메시지입니다. 그러나 두 번째 메시지는 빈 메시지입니다. 어떻게 netty 측면에서 수신 두 번째 메시지를 피할 수 있습니까?Netty Flash XmlSocket 메시지 수신 오류
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' }) };
}
}
나는 작동하지 않을까 걱정됩니다. "\ 0"대신에 null 구분 기호를 사용했습니다. 그러나 flash xmlsocket 개체가 메시지 수신 이벤트를 트리거하지 않았습니다. 또한, 하나의 메시지 대신 두 개의 메시지로 연결되는 "\ 0"과 null 구분 기호를 모두 시도했습니다. –
내가 링크 한 디코더를 사용해 보셨습니까? 실제로 프레임에 추가 바이트가있는 이유를 실제로 디코딩하고 볼 수 있습니다. 그것은 단서를 줄 수 있습니다. – Abe