[AIGC] Quickly master Netty and build a high-performance IM server!

Foreword: Netty is a very excellent network application framework that supports high concurrency and high performance network communication. It is suitable for developing various server programs, such as instant messaging, games, Internet of Things, etc. Using Netty can greatly improve the performance and reliability of server programs. This article will introduce the basic principles and […]

Implement privilege escalation by reusing TTY structures

Foreword UAF is a common vulnerability in user mode. There are also UAF vulnerabilities in the kernel. This is due to improper handling of the released space, resulting in the released heap blocks remaining The vulnerability created can be exploited. LK01-3 Let’s look at the UAF vulnerability based on the topic Project address: https://github.com/h0pe-ay/Kernel-Pwn/tree/master/LK01-3 open […]

[Netty] ByteToMessageDecoder source code analysis

Table of Contents 1.Protocol Description 2. Implementation of class 3.Decoder workflow 4. Source code analysis 4.1 Accumulator (data accumulation buffer) 4.2 Status code description 4.3 ByteToMessageDecoder#channelRead 4.4 Decoder implementation example 5. How to develop your own Decoder 1.Protocol Description The Netty framework is based on the Java NIO framework. It has powerful performance and supports […]

netty websocket unsafe

Initialization // org.yeauty.standard.WebsocketServer#init public void init() throws InterruptedException {<!– –> EventLoopGroup boss = new NioEventLoopGroup(config.getBossLoopGroupThreads()); EventLoopGroup worker = new NioEventLoopGroup(config.getWorkerLoopGroupThreads()); ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(boss, worker) .channel(NioServerSocketChannel.class) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.getConnectTimeoutMillis()) .option(ChannelOption.SO_BACKLOG, config.getSoBacklog()) .childOption(ChannelOption.WRITE_SPIN_COUNT, config.getWriteSpinCount()) .childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(config.getWriteBufferLowWaterMark(), config.getWriteBufferHighWaterMark())) .childOption(ChannelOption.TCP_NODELAY, config.isTcpNodelay()) .childOption(ChannelOption.SO_KEEPALIVE, config.isSoKeepalive()) .childOption(ChannelOption.SO_LINGER, config.getSoLinger()) .childOption(ChannelOption.ALLOW_HALF_CLOSURE, config.isAllowHalfClosure()) .handler(new LoggingHandler(LogLevel.DEBUG)) .childHandler(new ChannelInitializer<NioSocketChannel>() {<!– –> @Override protected void […]

[1227] Run the command line ttyd in the browser

Article directory Web Terminal Install use Basic usage Bind port Basic Auth Automatically open browser Docker support SSH terminal SSL support More Public network exposed Summarize Web Terminal ttyd: https://github.com/tsl0922/ttyd, a tool that can transfer the command line to web execution, written based on C. gotty: https://github.com/yudai/gotty, the same as ttyd, but written in Go […]

Impact of Netty MaxDirectMemorySize configuration on services

The impact of Netty MaxDirectMemorySize configuration on services Direct buffer memory OOM caused by MaxDirectMemorySize configuration once, analyze the cause through debugging. Application scenario: Using the Netty framework to process market push in a production environment Phenomena Error log java.lang.OutOfMemoryError: Direct buffer memory at java.nio.Bits.reserveMemory(Bits.java:175) ~[?:?] at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118) ~[?:?] at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:318) ~[?:?] at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:632) ~[netty-buffer-4.1.63.Final.jar!/:4.1.63.Final] […]

netty pipeline

Netty abstracts the pipeline data structure to process or intercept channel-related events. Events are divided into ChannelHandlers lists of inbound events (inBound events) and outbound events (outBound events). ChannelPipeline uses an advanced Intercepting Filter pattern that gives users complete control over how events are handled and how ChannelHandlers in the pipeline interact with each other. […]

Netty (3) Netty model

1. Netty model Netty has made certain improvements mainly based on the master-slave Reactor multi-thread model, in which the master-slave Reactor multi-thread model has multiple Reactors. Simplified layout: illustrate: BossGroup thread maintains Selector and only focuses on Accept When the Accept event is received, the corresponding SocketChannel is obtained, encapsulated into NIOSocketChannel and registered to […]

Netty data reading and writing source code reading

Data reading and writing write Let’s start with writing on the client side After the client establishes a connection with the server, it can get the connected channel object from the future. The channel here is the io.netty.channel.Channel object. Call its channel.writeAndFlush(msg); method to send data. writeAndFlush will call the writeAndFlush method of the pipeline […]