Building a chat client/server system with Netty in under 15 minutes.
Why Stack Overflow recommends it
Stack Overflow users link it as a worked example of a Netty chat server and client, both as an answer to broadcasting to multiple clients and as the tutorial that askers followed before hitting problems.
Recommended by 2 people across 2 different months, 2014 to 2014.
What it is
A short screencast from the Netty project that walks through building a basic chat client and server with Netty in under 15 minutes. It is based on the SecureChat example from the Netty repository and shows the bootstrap, handler and ChannelGroup setup.
What people said
Recommends user2183985 · 2014-04 · Stack Overflow · on “Netty trouble with chat server”
I'm having trouble figuring out what is wrong with the a simple Netty chat program I am working with. I have tried debugging through the program but it hasn't been able to show me where the problem even lies. Through debugging it seems like the client is connecting to the server, but the write function doesn't seem to be working. I followed the tutorial here [this video] . I have my source code here [LINK] on GitHub. Here is the Client classes. public void run() throws Exception { EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap bootstrap = new Bootstrap() .group(group) .channel(NioSocketChannel.class) .handler(new ChatClientInitializer()); Channel channel = bootstrap.connect(host,
Recommends Dave · 2014-11 · Stack Overflow · on “How could a Netty server send data to different clients?”
I'm betting this example [this video] should help you out (it's a YouTube video, so spare the comments about broken links please). In particular, it uses a ChannelGroup [LINK] to solve the problem of which you ask. And, yes, it goes in the handler on the server side. Edit: Notice too that in the example the ChannelGroup is static. I might argue it would be better to not use a static member and inject a ChannelGroup into the handler from the server class, but the simplicity of the static member may be preferable if you just want to get something working quickly.
Cites shim_ · 2014-01 · Stack Overflow · on “Netty channelRead never called”
I've played a bit with netty and followed a video( [this video] ) to build a chat server and client the server works properly(I tested with telnet and here it works) but the client does not recives data. The channelRead method in ChatClinetHandler.java were never called but the channelReadComplete were called. ChatClient.java import io.netty.bootstrap.Bootstrap; import io.netty.channel.Channel; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioSocketChannel; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.InetSocketAddress; import java.util.logging.Level; import java.util.logging.Logger; pu
Cites cargt3 · 2014-03 · Stack Overflow · on “ChannelInboundMessageHandlerAdapter cannot find symbol”
I try to make simple chat program base on this example [this video] . import io.netty.channel.ChannelHandlerContext; public class ChatClientHandler extends ChannelInboundMessageHandlerAdapter<String> { } I get cannot find symbol error. I'd also tried change SimpleInboundHandlerAdapter to SimpleInboundHandlerAdapter but with same result.