All of the methods return a ChannelFuture for which you can add a ChannelFutureListener to get notified about success / error. You can also call sync() if you want to block but this is usually not what you want.
> On 17 Jul 2016, at 04:12, [email protected] wrote: > > I found that if I just use Java try and cache to get exception, it is > unavailable to cache netty's exception, so any methods to get exception for > client connecting, client disconnecting, even writing? here is my netty > client code: > > final String ip = "127.0.0.1"; > final int port = 9001; > final EventLoopGroup g = new NioEventLoopGroup(); > final Bootstrap b = new Bootstrap(); > final ChannelFuture f = b.group(g) > .channel(NioSocketChannel.class) > .option(ChannelOption.TCP_NODELAY, true) > .option(ChannelOption.SO_REUSEADDR, true) > .option(ChannelOption.SO_KEEPALIVE, true) > .handler(new EchoClientInitializer()) > .connect(ip, port) > .sync(); > f.channel().closeFuture().sync(); > g.shutdownGracefully(); > > Thank! > > -- > You received this message because you are subscribed to the Google Groups > "Netty discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/netty/cdbd14ce-38a0-4b17-ae65-5874b719a3a1%40googlegroups.com > > <https://groups.google.com/d/msgid/netty/cdbd14ce-38a0-4b17-ae65-5874b719a3a1%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Netty discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/netty/B2D20935-1A84-4A75-9E86-0C946C7D9DAD%40googlemail.com. For more options, visit https://groups.google.com/d/optout.
