|
@@ -12,7 +12,11 @@ import com.smartsanitation.common.response.ResultWrapper;
|
|
|
import com.tidecloud.dataacceptance.response.CommandCopy;
|
|
|
import com.tidecloud.dataacceptance.service.impl.DiscardServerHandler;
|
|
|
|
|
|
+import io.netty.buffer.ByteBuf;
|
|
|
+import io.netty.buffer.Unpooled;
|
|
|
import io.netty.channel.Channel;
|
|
|
+import io.netty.channel.ChannelHandlerContext;
|
|
|
+import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
|
|
|
|
/**
|
|
|
* @author: chudk
|
|
@@ -32,12 +36,15 @@ public class WatchController {
|
|
|
}
|
|
|
Channel channel = channelMap.get(socketId);
|
|
|
try {
|
|
|
- logger.info("start write command to device");
|
|
|
- channel.writeAndFlush(commandStr);
|
|
|
- logger.info("end write command to device");
|
|
|
+ logger.info("start write command to device the address [{}]", channel.remoteAddress());
|
|
|
+ ByteBuf buffer = Unpooled.buffer(commandStr.length());
|
|
|
+ buffer.writeBytes(commandStr.getBytes());
|
|
|
+ channel.writeAndFlush(buffer);
|
|
|
+ logger.info("end write command to device the address [{}]", channel.remoteAddress());
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getLocalizedMessage());
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
}
|