Netty+SpringBoot creates a TCP long connection communication solution

Project background Recently, an Internet of Things project in the company needed to use socket long connections for message communication. I tinkered with a version of the code and put it online. As a result, there were constant bugs. I had trouble sleeping and eating, so I asked Du Niang for help. The project finally […]

Netty+SpringBoot creates a TCP long connection communication solution

Background of the project text 1. Project structure 2. Project module 3. Business process 4. Detailed explanation of code 5. Test 6. Source code postscript Project Background Recently, an Internet of Things project in the company needed to use socket long connections for message communication. I tinkered with a version of the code and put […]

Netty core source code analysis

Netty thread model The essence of Netty’s high-concurrency and high-performance architecture design Master-slave Reactor thread model NIO multiplexing non-blocking Lock-free serialization design ideas Supports high-performance serialization protocols Zero copy (direct memory usage) ByteBuf memory pool design Flexible TCP parameter configuration capability Concurrency optimization Lock-free serialization design idea In most scenarios, parallel multi-thread processing can improve […]

Netty optimization-parameter optimization

Netty optimization-parameter optimization 1.1 Parameter tuning 1) CONNECT_TIMEOUT_MILLIS 2) SO_BACKLOG 3) ulimit -n 4)TCP_NODELAY 5) SO_SNDBUF & SO_RCVBUF 6) ALLOCATOR 7)RCVBUF_ALLOCATOR 1.1 Parameter tuning Parameter configuration: Server: new ServerBootstrap().option() //Configure the parameters of ServerSocketChannel new ServerBootstrap().childOption() //Configure the parameters of SocketChannel Client: new Bootstrap().option() //Configure the parameters of SocketChannel 1) CONNECT_TIMEOUT_MILLIS Belongs to SocketChannal parameter […]

Netty encoder and decoder

Article directory 1. Decoder principle and practice 1. ByteToMessageDecoder decoder 2. Custom integer decoder 1) Conventional way 2)ReplayingDecoder decoder 3. Packet decoder 3. MessageToMessageDecoder decoder 2. Netty’s built-in Decoder 1. LineBasedFrameDecoder decoder 2. DelimiterBasedFrameDecoder decoder 3. LengthFieldBasedFrameDecoder decoder 3. Encoder Principle and Practice 1. MessageToByteEncoder encoder 2. MessageToMessageEncoder encoder 4. Combination of decoder and encoder […]

Netty practice — Netty handles sticky packet unpacking

TCP packet sticking/unpacking TCP processes data in a streaming manner. Unpacking: A complete data packet may be split into multiple packets by TCP for sending. Sticky packets: TCP may stick multiple small packets into one large data packet. Introduce dependency packages: <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>4.1.29.Final</version> </dependency> Example of sticky package unpacking: Server EchoServer: /** * […]

Middleware Security-CVE Recurrence&K8s&Docker&Jetty&Websphere Vulnerability Recurrence

Directory Service Attack and Defense-Middleware Security &CVE Recurrence &K8s &Docker &Jetty &Websphere Middleware-K8s Middleware-Jetty Vulnerability recurrence CVE-2021-28164-Path information disclosure vulnerability CVE-2021-28169 Double decoding information leakage vulnerability CVE-2021-34429 Path information disclosure vulnerability Middleware-Docker Vulnerability recurrence Daemon API Unauthorized Access Vulnerability Middleware-WebSphere Vulnerability recurrence Deserialization CVE-2015-7450 Weak password & amp; & amp;Background Getshell CVE-2020-4450 Service Attack and […]

Netty optimization – extending the serialization algorithm in custom protocols

Netty optimization – extending the serialization algorithm in custom protocols 1. Optimization and source code 1. Optimization 1.1 Extend the serialization algorithm in custom protocols 1. Optimization and source code 1. Optimization 1.1 Extend the serialization algorithm in custom protocols Serialization and deserialization are mainly used in the conversion of message body. When serializing, the […]

[Javascript] I am not satisfied with the Token non-perceptual refreshing scheme on the Internet, so I thought about it myself and it feels pretty good~

?Foreword Imagine that there is a super large form page, the user finally fills it out, and then clicks submit. At this time, the request interface actually returns 401, and then jumps to the login page. . . Then the user must have ten thousand idiots in his heart~~~ Therefore, it is necessary to implement […]