| | |
| | | @Override |
| | | protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) { |
| | | // 处理接收到的数据 |
| | | // ... |
| | | Channel channel = ctx.channel(); |
| | | ArdEquipRadar ardEquipRadar = DynamicClient.ConnectMap.get(channel); |
| | | // 处理接收到的消息 |
| | | byte[] byteArray = new byte[msg.readableBytes()]; |
| | | msg.getBytes(msg.readerIndex(), byteArray); |
| | | byte[] bytes = MessageParsing.receiveCompletePacket(byteArray); |
| | | if (bytes != null) { |
| | | processData(ardEquipRadar, bytes); |
| | | } |
| | | //byte[] byteArray = new byte[msg.readableBytes()]; |
| | | //msg.getBytes(msg.readerIndex(), byteArray); |
| | | //byte[] bytes = messageParsing.receiveCompletePacket(byteArray); |
| | | //if (bytes != null) { |
| | | // processData(ardEquipRadar, bytes); |
| | | //} |
| | | } |
| | | |
| | | @Override |
| | | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { |
| | | // 处理异常 |
| | | // ... |
| | | log.error("处理异常"); |
| | | log.error("处理异常"+cause.getMessage()); |
| | | } |
| | | |
| | | private ScheduledFuture<?> heartbeatTask; |