Channel open event for UDP and TCP on bind

fps fred.soulier.ml at gmail.com
Wed Jan 6 08:05:03 EST 2010


Hi

I've started using JBoss Netty recently after a 3 year spell with Apache
MINA so there are still things I'm trying to get my head around.

I'm experiencing a difference in behaviour for channel open events between
UDP and TCP.

For example using the following code:

UDP (using NIO)
===============
ConnectionlessBootstrap b = new ConnectionlessBootstrap(new
NioDatagramChannelFactory(Executors.newCachedThreadPool());
ChannelPipeline p = b.getPipeline();
p.addLast("handler", new MyHandler());
b.setOption("broadcast", "false");
b.bind(new InetSocketAddress(53001));

TCP (using NIO)
===============
ServerBootstrap b = new ServerBootstrap(new
NioSocketChannelFactory(Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
ChannelPipeline p = b.getPipeline();
p.addLast("handler", new MyHandler());
b.setOption("reuseAddress", "true");
b.bind(new InetSocketAddress(53000));

I get a channel open event triggered by the bind for the UDP version and no
channnel open event for the TCP version...
MyHandler defines a channelOpen(...) method which logs the event.

I don't really understand why? Is there a reason for that?

I've seen the same thing with both Netty 3.1.5 and 3.2.0 Alpha2. Also tried
both Nio and Oio for UDP with the same result.

Thx
Frederic
-- 
View this message in context: http://n2.nabble.com/Channel-open-event-for-UDP-and-TCP-on-bind-tp4260514p4260514.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list