update 电单车协议

This commit is contained in:
Guoqs
2024-07-15 11:33:11 +08:00
parent 450d6799a6
commit 2186b3e857
8 changed files with 192 additions and 69 deletions

View File

@@ -16,8 +16,9 @@ import javax.annotation.Resource;
import java.net.InetSocketAddress;
@Slf4j
@Component
@Order(2)
@Deprecated
// @Component
// @Order(3)
public class NettyServer implements CommandLineRunner {
@Resource
private NettyServerChannelInitializer nettyServerChannelInitializer;

View File

@@ -21,7 +21,7 @@ public class NettyServerChannelInitializer extends ChannelInitializer<SocketChan
protected void initChannel(SocketChannel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
// pipeline.addLast("frameDecoder",new CustomDecoder());
pipeline.addLast("frameDecoder", new StartAndLengthFieldFrameDecoder(0x68));
pipeline.addLast("frameDecoder", new StartAndLengthFieldFrameDecoder());
pipeline.addLast("decoder", new ByteArrayDecoder());
pipeline.addLast("encoder", new ByteArrayDecoder());
//读超时时间设置为10s0表示不监控