Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Multicast question
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
newbie  
View profile  
 More options Sep 13 2010, 5:00 am
From: newbie <newbie...@yahoo.com.tw>
Date: Mon, 13 Sep 2010 02:00:50 -0700 (PDT)
Local: Mon, Sep 13 2010 5:00 am
Subject: Multicast question
Is multicast supported in kilim?

In the example dir, it seems only SocketChannel is provided (in
Ping.java).

Can I simple use something e.g. DatagramPacket to achieve multicast
feature? Or additional work is required?

I appreciate any suggestion.

Many thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sriram Srinivasan  
View profile  
 More options Sep 13 2010, 4:03 pm
From: Sriram Srinivasan <ki...@malhar.net>
Date: Mon, 13 Sep 2010 13:03:08 -0700
Local: Mon, Sep 13 2010 4:03 pm
Subject: Re: Multicast question

On Sep 13, 2010, at 2:00 AM, newbie wrote:

> Is multicast supported in kilim?

No, there is no multicast support in kilim/nio.

As you observed, I use SocketChannel, and I believe one should be able  
to get away with using SelectableChannel, in order to accomodate both  
DatagramChannel and SocketChannel.  If you do this refactoring, I'd be  
immensely grateful and can roll it in.

--sriram.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
newbie  
View profile  
 More options Sep 21 2010, 6:40 am
From: newbie <newbie...@yahoo.com.tw>
Date: Tue, 21 Sep 2010 03:40:48 -0700 (PDT)
Local: Tues, Sep 21 2010 6:40 am
Subject: Re: Multicast question
Hi Sriram,

I am happy to do that. But whilst testing to implement MulticastSocket
function, I encountered a problem.

At receiving side (e.g. MulticastSocket.receive()), it keeps throwing
message e.g.

java.nio.channels.IllegalSelectorException
        at sun.nio.ch.SelectorImpl.register(SelectorImpl.java:111)
        at
java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectable Channel.java:
180)
        at
java.nio.channels.SelectableChannel.register(SelectableChannel.java:
254)
        at kilim.nio.NioSelectorScheduler
$RegistrationTask.execute(NioSelectorScheduler.java:324)
        at kilim.Task._runExecute(Task.java:432)
        at kilim.nio.NioSelectorScheduler
$SelectorThread.run(NioSelectorScheduler.java:198)

when receiving packet from the client.

After checking the code, looks like it is issued by SelectorImpl.java
in which

   protected final SelectionKey register(AbstractSelectableChannel ch,
                                          int ops,
                                          Object attachment)
    {
        if (!(ch instanceof SelChImpl))
            throw new IllegalSelectorException();
...
    }

it checks the channel passed in required to implement SelChImpl.
Unfortunately, SelChImpl is not public, resulting
in the compiler complains `... <subclass that extends > ... cannot
access its superinterface sun.nio.ch.SelChImpl,'
if trying to implements SelChImpl class.

This message comes from my code (PollSelectorProvider) where to open
the Multicast Socket function, e.g.

   public static AbstractSelectableChannel open(int port) throws
IOException{
        return new AbstractMulticastSocket(new
sun.nio.ch.PollSelectorProvider(), port);
    }

However, I think because I am not familiar with this I do not have any
good idea on how to get around it. Is there any chance
to provide any hint or advice? Or point me to where there may contain
related resource/ doc?

I appreciate any suggestion.

Testing code:
MulticastSocketWrapper - http://pastebin.com/u8SA3rMG
NioSelectorScheduler - http://pastebin.com/2CK6nwHR

On Sep 14, 4:03 am, Sriram Srinivasan <ki...@malhar.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sriram Srinivasan  
View profile  
 More options Sep 21 2010, 9:54 am
From: Sriram Srinivasan <ki...@malhar.net>
Date: Tue, 21 Sep 2010 06:54:53 -0700
Local: Tues, Sep 21 2010 9:54 am
Subject: Re: Multicast question
I see. This will require more digging then.

The basic issue is that you need to receive multicast sockets and work  
with Kilim tasks. Most likely you have just the single multicast  
socket, one reasonable alternative -- at least for now --  is to have  
a separate thread blocked on that multicast socket? Whenever you  
receive a packet, put it in some task's mailbox and return to blocking  
on that socket.

--sriram.

On Sep 21, 2010, at 3:40 AM, newbie wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
newbie  
View profile  
 More options Sep 23 2010, 4:56 am
From: newbie <newbie...@yahoo.com.tw>
Date: Thu, 23 Sep 2010 01:56:11 -0700 (PDT)
Local: Thurs, Sep 23 2010 4:56 am
Subject: Re: Multicast question
I switch to use a separate Task receiving incoming packet and
basically looks like it works. But an message is thrown once the
socket received a packet saying

java.net.SocketException: Address already in use
        at java.net.PlainDatagramSocketImpl.join(Native Method)
        at java.net.PlainDatagramSocketImpl.join(PlainDatagramSocketImpl.java:
172)
        at java.net.MulticastSocket.joinGroup(MulticastSocket.java:277)
        at
kilim.nio.MulticastSocketWrapper.joinGroup(MulticastSocketWrapper.java:
61)
        at kilim.nio.NioSelectorScheduler
$MulticastListenTask.execute(NioSelectorScheduler.java:245)
        at kilim.Task._runExecute(Task.java:432)
        at kilim.nio.NioSelectorScheduler
$SelectorThread.run(NioSelectorScheduler.java:198)

And this cause the server would only receive packet once only.

My guess is because RegistrationTask registers channel with a
SlectionKey returned; therefore, the SelectorThread can select channel
with different key. Unfortunately,
the separate task uses MulticastSocket instead of Channel instance so
the register() function in RegistrationTask won't actually perform
register procedure as channel
passed in is null.

I notice that seems can be modified by customizing
SelectorImpl.register() function, but again a similar issue as
previous one would happen again (The default implementation
can not be reused if I am correct). Before doing this, I would like to
double check if this is the right direction (because some more detail
I may not be aware of, though I've dug a
bit into the source), or there is an alternative way to get around
this issue.

Modified code:
http://pastebin.com/3TTq2pAX
http://pastebin.com/T4FWyDXQ
http://pastebin.com/VUCYgEmP

I appreciate any advice.

Thank you.

On Sep 21, 9:54 pm, Sriram Srinivasan <ki...@malhar.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sriram Srinivasan  
View profile  
 More options Sep 23 2010, 10:06 am
From: Sriram Srinivasan <ki...@malhar.net>
Date: Thu, 23 Sep 2010 07:06:20 -0700
Local: Thurs, Sep 23 2010 10:06 am
Subject: Re: Multicast question
Hi,

 From a _very_ cursory look at the source, I'm puzzled by one  
conspicuous omission: there is no import of DatagramChannel.
Perhaps that is the key to the solution.

See also Alan Bateman's blog entry on this topic:

http://blogs.sun.com/alanb/entry/multicasting_with_nio

--sriram.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
newbie  
View profile  
 More options Oct 11 2010, 12:48 pm
From: newbie <newbie...@yahoo.com.tw>
Date: Mon, 11 Oct 2010 09:48:51 -0700 (PDT)
Local: Mon, Oct 11 2010 12:48 pm
Subject: Re: Multicast question
I just submitted a patch through github, but not very sure if that's
the formal way (I can't find something e.g. issue tracking to create
an issue and add patch as attachment.)

Please let me know if ant issue relates.

Many thanks.

On 9月23日, 下午10時06分, Sriram Srinivasan <ki...@malhar.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sriram Srinivasan  
View profile  
 More options Oct 11 2010, 10:20 pm
From: Sriram Srinivasan <ki...@malhar.net>
Date: Mon, 11 Oct 2010 19:20:40 -0700
Local: Mon, Oct 11 2010 10:20 pm
Subject: Re: Multicast question

On Oct 11, 2010, at 9:48 AM, newbie wrote:

> I just submitted a patch through github, but not very sure if that's
> the formal way (I can't find something e.g. issue tracking to create
> an issue and add patch as attachment.)

> Please let me know if ant issue relates.

thanks much. I'll take a look at the patch.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »