Parcourir la source

修改netty长度

lgy il y a 3 ans
Parent
commit
2af1eacb05
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      src/main/java/com/persagy/client/GroupNettyClient.java

+ 2 - 2
src/main/java/com/persagy/client/GroupNettyClient.java

@@ -79,8 +79,8 @@ public class GroupNettyClient {
                     .handler(new ChannelInitializer<SocketChannel>() {
                         @Override
                         protected void initChannel(SocketChannel ch) throws Exception {
-                            ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4));
-                            ch.pipeline().addLast(new LengthFieldPrepender(4));
+                            ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 6, 0, 6));
+                            ch.pipeline().addLast(new LengthFieldPrepender(6));
                             // 将分隔之后的字节数据转换为字符串
                             ch.pipeline().addLast(new StringDecoder());
                             ch.pipeline().addLast(new StringEncoder());