mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
同步获取响应数据
This commit is contained in:
@@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@ChannelHandler.Sharable
|
||||
@Slf4j
|
||||
@Component
|
||||
public class NettyServerHandler extends ChannelInboundHandlerAdapter {
|
||||
public class NettyServerHandler extends SimpleChannelInboundHandler {
|
||||
|
||||
@Autowired
|
||||
private YKCBusinessService ykcService;
|
||||
@@ -66,7 +66,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
|
||||
*/
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object message) throws Exception {
|
||||
// log.info("加载客户端报文=== channelId:" + ctx.channel().id() + ", msg:" + msg);
|
||||
log.info("加载客户端报文channelRead=== channelId:" + ctx.channel().id() + ", msg:" + message);
|
||||
// 下面可以解析数据,保存数据,生成返回报文,将需要返回报文写入write函数
|
||||
byte[] msg = (byte[]) message;
|
||||
|
||||
@@ -109,6 +109,11 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
log.info("channelRead0=== channelId:" + ctx.channel().id() + ", msg:" + msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 有客户端终止连接服务器会触发此函数
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user