當前位置:編程學習大全網 - 網站源碼 - channelread中buf.readunsignedShortLe為什麽有的值為0

channelread中buf.readunsignedShortLe為什麽有的值為0

channelread中buf.readunsignedShortLe為什麽有的值為0?這個問題很簡單,是因為程序在運行時候出現了空值,所以他得值為0。

擴展資料

需要編解碼的才會去用messageReceived,壹般都是使用ChannelRead來讀取的。

SimpleChannelInboundHandler的源代碼妳就知道了,泛型不匹配,不會調用messageReceived的。

另:如果妳特別特別想用SimpleChannelInboundHandler,妳可以這樣搞:public classYouTCPServerHandler extends SimpleChannelInboundHandler<ByteBuf>{...}

因為妳沒有做過任何的編碼解碼,所以妳的泛型是ByteBuf,這樣妳肯定可以使用messageReceived來接收到消息了。

  • 上一篇:Android小源代碼分析
  • 下一篇:農機作業北鬥遠程監測系統怎麽安裝打捆機
  • copyright 2024編程學習大全網