Multicast channels...?

S

SabaUd

Hello,
I have an application that is using many DatagramChannels, and
registers them to a Selector.
Now, I want to add a multicast communication to the application.
The MulticastSocket extends the DatagramSocket, but there seem to be
no "MulticastChannel".
The DatagramChannel.open() method creates a channel with a
DatagramSocket.
Is there anyway to "set" the wanted socket for the channel? Or is
there any Channel that can be defined in the socket it opens?

Thank's
Udi
 
G

Gordon Beaton

Now, I want to add a multicast communication to the application. The
MulticastSocket extends the DatagramSocket, but there seem to be no
"MulticastChannel".

Create a MulticastSocket with the desired properties and call
getChannel() to get the channel for it.

/gordon

--
 
S

SabaUd

Create a MulticastSocket with the desired properties and call
getChannel() to get the channel for it.

Can't... The getChannel() method returns the channel associated with
the socket if (and only if) the channel was created with the
DatagramChannel.open() method. Otherwise the method returns null...
 
G

Gordon Beaton

Can't... The getChannel() method returns the channel associated with
the socket if (and only if) the channel was created with the
DatagramChannel.open() method. Otherwise the method returns null...

Hmm sorry. Strange though that MulticastSocket inherits the
getChannel() method from DatagramSocket when there is (AFAIK) no other
way to create the necessary channel.

This might offer more insight into the situation:
http://blogs.sun.com/alanb/entry/multicasting_with_nio

/gordon

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top