UDP woes...
fps
fred.soulier.ml at gmail.com
Thu Jan 14 13:03:49 EST 2010
Hi
Ok I've got the following class which creates the ConnectionlessBootstrap
for UDP with a very simple pipeline.
I'm running a test in the same where I bootstrap the UDP server then starts
to UDP clients.
My ConnectionHandler has a @ChannelPipelineCoverage("one") yet both clients
end up using the same channel handler context which creates a mess when
processing the messages...
I can see client #1 127.0.0.1:54634 and client #2 127.0.0.1:55789
Am I missing something here?
public class Udp implements Pipeline, ChannelPipelineFactory
{
private ConnectionlessBootstrap bootstrap;
private Channel channel;
public Udp(int port)
{
bootstrap = new ConnectionlessBootstrap(new
NioDatagramChannelFactory(Executors.newCachedThreadPool(),
Runtime.getRuntime().availableProcessors()));
bootstrap.setPipelineFactory(this);
bootstrap.setOption("receiveBufferSizePredictorFactory",
new FixedReceiveBufferSizePredictorFactory(1400));
bootstrap.setOption("child.broadcast", false);
channel = (DatagramChannel)bootstrap.bind(new InetSocketAddress(port));
}
public Bootstrap getBootstrap()
{
return bootstrap;
}
public Channel getChannel()
{
return channel;
}
public ChannelPipeline getPipeline()
throws Exception
{
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("connection", new ConnectionHandler());
return pipeline;
}
}
Thx
Fred
--
View this message in context: http://n2.nabble.com/UDP-woes-tp4394311p4394311.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list