迅捷的软件产品制作专家 2023-07-28 12:08 采纳率: 29.4%
浏览 5
已结题

netty handler顺序是怎么样的?

1.hander 不执行?
2.代码如下:


```java
public class RecevieHandler extends SimpleChannelHandler{

    private static Logger LOG = LoggerFactory.getLogger(RecevieHandler.class);


    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e){
        Message msg = (Message) e.getMessage();
        LOG.error("应答----------------" + "0x" + Integer.toHexString(msg.getMsgId()));
        if(msg.getMsgId() == JT809Constants.UP_CONNECT_RSP){
            ChannelBuffer msgBody = msg.getMsgBody();
            int result = msgBody.readByte();
            if(result == JT809Constants.UP_CONNECT_RSP_SUCCESS){
//                TcpClientFuJian.LONGINSTATUS = Constants.LOGIN_SUCCESS;
                LOG.error("------------------登录成功");
            }else{
                LOG.error("------------------登录异常,请检查" + "0x0" + Integer.toHexString(result));
            }
        }
    }
}


``

  • 写回答

2条回答 默认 最新

  • Watch the clown 2023-07-28 15:32
    关注

    你代码里还有其他handler嘛?报错是什么?光看这个看不出来有什么错误

    本回答被专家选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 8月11日
  • 专家已采纳回答 8月3日
  • 创建了问题 7月28日