Multicast channels...?

Discussion in 'Java' started by SabaUd, Feb 24, 2008.

  1. SabaUd

    SabaUd Guest

    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
    SabaUd, Feb 24, 2008
    #1
    1. Advertising

  2. On Sun, 24 Feb 2008 01:21:50 -0800 (PST), SabaUd wrote:
    > 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

    --
    Gordon Beaton, Feb 24, 2008
    #2
    1. Advertising

  3. SabaUd

    SabaUd Guest

    > 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...
    SabaUd, Feb 24, 2008
    #3
  4. On Sun, 24 Feb 2008 04:03:39 -0800 (PST), SabaUd wrote:
    >> 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...


    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

    --
    Gordon Beaton, Feb 24, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. clintonG
    Replies:
    0
    Views:
    379
    clintonG
    Jul 3, 2004
  2. Sebastian Loncar

    How to use multiple channels

    Sebastian Loncar, Mar 3, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,794
    Sebastian Loncar
    Mar 3, 2006
  3. steven robinson
    Replies:
    0
    Views:
    366
    steven robinson
    Apr 30, 2004
  4. Bulent Erdemir
    Replies:
    0
    Views:
    365
    Bulent Erdemir
    Jul 23, 2004
  5. Saaji
    Replies:
    0
    Views:
    320
    Saaji
    Apr 5, 2006
Loading...

Share This Page