Skip to content

Tag: netty

netty-incubator-codec-quic: How to get remoteAddress?

I need to know the remote address at the server side. I tried bellow ways and failed: QuicStreamChannel.remoteAddress() returns QuicStreamAddress, which cannot be casted to InetSocketAddress. QuicStreamAddress or QuicConnectionAddress does not contain remote IP address or port at all. class io.netty.buffer.PooledUnsafeDirectByteBuf cannot be cast to class so I cannot use DatagramPacket.sender() to get the sender address. (QuicChannel) ( —

Make order of responses match order of requests in Netty

Context I am writing a Netty application (Netty 4) in which the processing of each message might take some time. As an example of what I mean I have created an EchoHandler that responds with the original message, though sometimes after a short delay: Problem Using this code, the order of the responses is not guaranteed to be the same

How to send both commands and files using Netty

I don’t understand what I’m doing wrong. How to send both commands and files. Below are the server and client pipelines. client pipeline: server pipeline: The fact is that before I send the file, I send a command (FileInfo) that the file described in this FileInfo will be sent soon. Then the file itself is sent (byte Buf), Like FileInfo,

Does each new client connection create a new Channel?

New to netty here. But my question here is: when we establish a connection from a client to server, would this create a new Channel for each new connection. Would this also subsequently create an associated pipeline for each new client connection. (e.g. would 100 clients that are simultaneously connected to a server create 100 individual channels with 100 associated

what’s the meaning of server.onDispose().block()?

There are few web pages about reactor-netty on the internet. And I don’t understand the meaning of some code below. These code below is just ABC of reactor-netty. But I really can not find more information on the internet. So I have to ask for help. Please help me with the five places in the code above. Thank you. Answer

Why is my maven build not finding Netty’s EventLoopGroup class when executing?

I wrote my code following Netty’s documentation, then I execute: It builds successfully. Then I run: And it promts me with this error: Exception in thread “main” java.lang.NoClassDefFoundError: io/netty/channel/EventLoopGroup at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods( at java.lang.Class.privateGetMethodRecursive( at java.lang.Class.getMethod0( at java.lang.Class.getMethod( at sun.launcher.LauncherHelper.validateMainClass( at sun.launcher.LauncherHelper.checkAndLoadMain( Caused by: java.lang.ClassNotFoundException: at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( … 7 more To

Why event loop uses more than one thread?

I always thought that asynchronous execution is about efficient resource utilization and thread safety, but today I ran into Netty’s strange behavior. public class Example { public static void …

Netty writeAndFlush() incomplete

My tcp client request netty server, and netty server use writeAndFlush() return 393718 bytes. But the client only receive 262142 bytes. I use “tcpdump -A” to apturing packets, less than 393718 too. So I think the properble is in netty writeAndFlush() function? Here is the code tcp server: server handler: tcp client: Answer You close the connection directly after writing,

Package does not exist

Which JAR contains I’m not using Maven or Ivy, just Ant. Ant compile gives: In the classpath is: The library is netty-4.0.21.Final.tar.bz2, which was downloaded from the official Netty website. I added each JAR from that download to the project. Yes, I realize it’s not using the CLI javac classpath, but the JAR’s are visible in the project, as