| | |
| | | import com.ard.utils.util.GisUtils; |
| | | import com.ard.utils.mqtt.MqttProducer; |
| | | import io.netty.buffer.ByteBuf; |
| | | import io.netty.channel.Channel; |
| | | import io.netty.channel.ChannelHandlerContext; |
| | | import io.netty.channel.ChannelId; |
| | | import io.netty.channel.SimpleChannelInboundHandler; |
| | |
| | | |
| | | import javax.xml.bind.DatatypeConverter; |
| | | import java.net.InetSocketAddress; |
| | | import java.net.SocketAddress; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ScheduledFuture; |
| | |
| | | int port = ipSocket.getPort(); |
| | | String host = ipSocket.getHostString(); |
| | | log.error("与设备" + host + ":" + port + "连接断开!"); |
| | | ArdEquipRadar ardEquipRadar = ClientInitialize.tureConnectMap.get(id); |
| | | ArdEquipRadar ardEquipRadar = ClientInitialize.tureConnectMap.get(host+ ":" + port); |
| | | // 连接断开后的最后处理 |
| | | ctx.pipeline().remove(this); |
| | | ctx.deregister(); |
| | |
| | | */ |
| | | @Override |
| | | public void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception { |
| | | ChannelId id = ctx.channel().id(); |
| | | ArdEquipRadar ardEquipRadar = ClientInitialize.tureConnectMap.get(id); |
| | | InetSocketAddress ipSocket = (InetSocketAddress) ctx.channel().remoteAddress(); |
| | | int port = ipSocket.getPort(); |
| | | String host = ipSocket.getHostString(); |
| | | ArdEquipRadar ardEquipRadar = ClientInitialize.tureConnectMap.get(host+":"+port); |
| | | // 处理接收到的消息 |
| | | byte[] byteArray = new byte[msg.readableBytes()]; |
| | | msg.getBytes(msg.readerIndex(), byteArray); |