Multicast receiver issue

Trustin Lee (이희승) trustin at gmail.com
Tue Nov 10 21:40:07 EST 2009


Hello Davide,

Thanks for reporting a problem first of all.

This is weird.  Could you please post the working legacy code so that
I can find the difference?

— Trustin Lee, http://gleamynode.net/



On Wed, Nov 11, 2009 at 1:25 AM, Davide Rossoni
<rossoni.davide at gmail.com> wrote:
>
> I'm trying to adopt Netty in order to re-implement my Multicast Sender and
> Receiver.
>
> It works fine with the MulticastSender using Netty with old blocking I/O,
> but I spent three days trying to understand how to implements the
> MulticastReceiver: I did not receive any multicast message.
>
> Please note that using a simple java MulticastSocket implementation it works
> very well, and I receive data sent from the Netty-MulticastSender.
>
> Could you help me?
>
> Here an extract of my Receiver class:
>
> DatagramChannelFactory datagramChannelFactory = new
> OioDatagramChannelFactory(Executors.newCachedThreadPool());
>
> ConnectionlessBootstrap connectionlessBootstrap = new
> ConnectionlessBootstrap(datagramChannelFactory);
> ChannelPipeline channelPipeline = connectionlessBootstrap.getPipeline();
>
> channelPipeline.addLast("handler", new MulticastReceiverHandler());
>
> connectionlessBootstrap.setOption("receiveBufferSize", receiveBufferSize);
> connectionlessBootstrap.setOption("sendBufferSize", sendBufferSize);
> connectionlessBootstrap.setOption("trafficClass", trafficClass);
> connectionlessBootstrap.setOption("soTimeout", soTimeout);
> connectionlessBootstrap.setOption("broadcast", broadcast);
> connectionlessBootstrap.setOption("loopbackMode", loopbackMode);
> connectionlessBootstrap.setOption("reuseAddress", reuseAddress);
>
> DatagramChannel datagramChannel = (DatagramChannel)
> connectionlessBootstrap.bind(new InetSocketAddress(172.26.16.20, 0));
>
> InetSocketAddress multicastAddress = new InetSocketAddress(228.10.10.10,
> 2222);
> NetworkInterface networkInterface =
> NetworkInterface.getByInetAddress(InetAddress.getByName(PriceFeederHelper.multicastNIC));
> datagramChannel.joinGroup(multicastAddress, networkInterface);
>
>
>
> Here my ReceiverHandler class:
>
> @ChannelPipelineCoverage("all")
> public class MulticastReceiverHandler extends SimpleChannelHandler {
>
>       private final Logger logger = LoggerFactory.getLogger(getClass());
>
>       @Override
>       public void messageReceived(ChannelHandlerContext ctx, MessageEvent
> e) throws Exception {
>               logger.info("message = " + e.getMessage());
>
>               ctx.sendUpstream(e);
>       }
>
>       @Override
>       public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
> e) throws Exception {
>               logger.error("Unexpected exception from downstream.",
> e.getCause());
>               e.getChannel().close();
>
>               super.exceptionCaught(ctx, e);
>       }
>
> }
>
> --
> View this message in context: http://n2.nabble.com/Multicast-receiver-issue-tp3980856p3980856.html
> Sent from the Netty Developer Group mailing list archive at Nabble.com.
> _______________________________________________
> netty-dev mailing list
> netty-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-dev
>



More information about the netty-dev mailing list