This topic is now archived and is closed to further replies.


[java] Multicast Channels

Recommended Posts

It it possible to have a DatagramChannel send and receive multicast messages? I tried this group = new InetSocketAddress(InetAddress.getByName(""),5000); channel =; channel.configureBlocking(false); channel.socket().setReuseAddress(true); channel.socket().setBroadcast(true); channel.socket().bind(group); channel.register(selector, SelectionKey.OP_READ); The bind get and exception " Cannot assign requested address: bind" I understand the error I''m just not setting up the socket correctly. Since the channel.socket() only returns a DatagramSocket and not MulticastSocket I''m thinking you can''t except why is there a setBroadcast() method? I''ve been searching the net for the past hour with no luck. All of my existing network code uses Channels and I would like to avoid just using a non-channeled MulticastSocket if possible. Any ideas?

Share this post

Link to post
Share on other sites