이 메시지에서 Command를 통해 각 로직을 진행 중에 있고요.
여기서 10000 Byte가 넘어가는 메시지가 들어오게되면 메시지를 못 받는 문제가 생깁니다.
그리고 이 메시지에 대해 같은 위치에서 짤리고 있습니다.
public void run() throws InterruptedException {
EventLoopGroup bossGroup = new NioEventLoopGroup(5);
EventLoopGroup workerGroup = new NioEventLoopGroup();
ServerBootstrap bootStrap = new ServerBootstrap();
bootStrap.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(serverSocketHandler);
}
})
.option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.SO_KEEPALIVE, true)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
try {
ChannelFuture channelFuture = bootStrap.bind(port).sync();
channelFuture.channel().closeFuture().sync();
} catch (InterruptedException e) {
log.error("Interrupted : ", e);
Thread.currentThread().interrupt();
} finally {
bossGroup.shutdownGracefully().sync();
workerGroup.shutdownGracefully().sync();
}
log.info("[SYSTEM] Netty NIO SOCKET SERVER BINDING AND RUN / PORT : {}", port);
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
ByteBuf bytes = (ByteBuf) msg;
try {
log.info("READ BYTE : {}", bytes.toString(StandardCharsets.UTF_8).length());
nettyReceivedStr.append(bytes.toString(StandardCharsets.UTF_8));
} catch (Exception e) {
e.printStackTrace();
} finally {
bytes.release();
}
}
이렇게 코딩 했습니다.