0

someone can help me to understand the netty behavior when starting the same bootstrap server twice. I can't catch any exception. See my code :

bootstrap = new ServerBootstrap();

bootstrap.group(nioEventLoopGroup);
bootstrap.channel(NioServerSocketChannel.class);

bootstrap.option(ChannelOption.TCP_NODELAY, Boolean.valueOf(true));
bootstrap.option(ChannelOption.SO_KEEPALIVE, Boolean.valueOf(true));
bootstrap.option(ChannelOption.SO_REUSEADDR, Boolean.valueOf(true));

bootstrap.childHandler(new ServerSocketBasedInitializer(messageFacade));

allChannels.add(bootstrap.bind(new InetSocketAddress(80)).channel());

I' using netty4.0.0.Beta2.

Siguza
  • 21,155
  • 6
  • 52
  • 89
user2166924
  • 11
  • 1
  • 4
  • Refer to my answer at : http://stackoverflow.com/questions/8027411/bootstrap-error-ios-5-0-simulator-in-xcode-4-2/16134344#16134344 – DShah Apr 21 '13 at 17:54

1 Answers1

0

I may missunderstand you but I think what you want todo is to check the ChannelFuture which is returned by the bind() operation to see if it was successful or not.

bind() is an async operation so it may not be done directly. If you want to block until it is done ad get and exception thrown automatically use bind().sync() for it.

Norman Maurer
  • 23,104
  • 2
  • 33
  • 31