StringEncoder 是否随机拆分了一个极长的字符串?
Is StringEncoder splitting an extremely long string randomly?
我正在尝试发送一些带有 RCS Public 的 JSON 字符串,并在其中输入 GSON。每当字符串被传输到客户端时,它就会被拆分。
目前我只有这些编码器(它们基本上是具有一些额外功能的字符串编码器)
我是否需要任何额外的编码器或解码器来将字符串连接在一起,或者我是否需要手动编码?如果我这样做,关于如何做的任何解释?
JSON 字符串的示例如下:https://pastebin.com/UkDGKHya
public 密钥是唯一的,每次发送数据包时都会生成,尽管它只发送一次用于注册客户端。
服务器:
ch.pipeline().addLast("stringDecoder", new EncryptedGSONObjectDecoder(CharsetUtil.UTF_8, keyFinder));
ch.pipeline().addLast("stringEncoder", new EncryptedGSONObjectEncoder(CharsetUtil.UTF_8, keyFinder));
ch.pipeline().addLast(processingHandler);
客户:
ch.pipeline().addLast("readTimeoutHandler", new ReadTimeoutHandler(15));
ch.pipeline().addLast("stringDecoder",new EncryptedGSONObjectDecoder(CharsetUtil.UTF_8, Client.this));
ch.pipeline().addLast("stringEncoder", new EncryptedGSONObjectEncoder(CharsetUtil.UTF_8, Client.this));
ch.pipeline().addLast(clientHandler);
我只需要添加一个 LineBasedFrameDecoder 并在编码时在字符串末尾添加“\n\r”
我正在尝试发送一些带有 RCS Public 的 JSON 字符串,并在其中输入 GSON。每当字符串被传输到客户端时,它就会被拆分。
目前我只有这些编码器(它们基本上是具有一些额外功能的字符串编码器)
我是否需要任何额外的编码器或解码器来将字符串连接在一起,或者我是否需要手动编码?如果我这样做,关于如何做的任何解释?
JSON 字符串的示例如下:https://pastebin.com/UkDGKHya public 密钥是唯一的,每次发送数据包时都会生成,尽管它只发送一次用于注册客户端。
服务器:
ch.pipeline().addLast("stringDecoder", new EncryptedGSONObjectDecoder(CharsetUtil.UTF_8, keyFinder));
ch.pipeline().addLast("stringEncoder", new EncryptedGSONObjectEncoder(CharsetUtil.UTF_8, keyFinder));
ch.pipeline().addLast(processingHandler);
客户:
ch.pipeline().addLast("readTimeoutHandler", new ReadTimeoutHandler(15));
ch.pipeline().addLast("stringDecoder",new EncryptedGSONObjectDecoder(CharsetUtil.UTF_8, Client.this));
ch.pipeline().addLast("stringEncoder", new EncryptedGSONObjectEncoder(CharsetUtil.UTF_8, Client.this));
ch.pipeline().addLast(clientHandler);
我只需要添加一个 LineBasedFrameDecoder 并在编码时在字符串末尾添加“\n\r”