users@grizzly.java.net

Re: multicast over Grizzly ?

From: Survivant 00 <survivant00_at_gmail.com>
Date: Tue, 11 Aug 2009 09:41:21 -0400

I had a sample that worked for one case.. but it was long time ago and it
was only for testing.. now that I have something working and ready to
migrate, it's more easy.

I don't mind using Grizzly 2.0. Will need to try it for once :)


Would be great it if we can have that soon. JGroups can't do that (because
they are adding headers to the messages), Mina don't plan that until 3.0.
Still waiting for Netty response.

For me it's something that look basic, just don't know why it's not
implemented, maybe people using more TCP..


Do you thing you can provide a draft soon ?




2009/8/11 Oleksiy Stashok <Oleksiy.Stashok_at_sun.com>

> Hi Sebastien,
>
> No body had an idea how to do that ?
>
> Sorry, it's quite tough with time now...
> Don't we try to workaround this using asynchronous write queue? I remember
> we were solving something with multicasting, don't we?
>
> I checked in the unittest and we have UDPIOClient. But it's using plain
> DatagramSocket.
>
> Right.
>
>
> I have 3 cases.
>
> #1 - Send a UDP message using MulticastSocket and close the socket.
> #2 - Send a UDP message using DatagramSocket but wait for a response (wait
> until TTL)
> #3 - Listen for UDP message using MulticastSocket (while(true))
>
> Probably I can try to implement that for Grizzly 2.0, cause for Grizzly
> 1.9.x it could mean changing existing API, which I don't want to do :)
>
> WBR,
> Alexey.
>
>
>
>
>
>
> 2009/8/7 Survivant 00 <survivant00_at_gmail.com>
>
>> I didn't mean multicast like JDK7.. but a broadcast like this
>>
>> SERVER
>> MulticastSocket ssdpUniSock = null;
>> InetAddress group = null;
>>
>> try {
>> group = InetAddress.getByName(host);
>> ssdpUniSock = new MulticastSocket(port);
>> ssdpUniSock.joinGroup(group);
>>
>> byte ssdvRecvBuf[] = new byte[1024];
>> DatagramPacket dgmPacket2 = new DatagramPacket(ssdvRecvBuf,
>> 1024);
>>
>> ssdpUniSock.receive(dgmPacket2);
>>
>> .....
>>
>> CLIENT
>>
>> MulticastSocket ssdpUniSock = new MulticastSocket(null);
>> ssdpUniSock.setReuseAddress(true);
>>
>> String msg = "Grizzly is the best";
>>
>> logger.info("sending message \n" + msg);
>>
>> DatagramPacket dgmPacket = new DatagramPacket(msg.getBytes(),
>> msg.length(), InetAddress.getByName(host), port);
>>
>> ssdpUniSock.send(dgmPacket);
>>
>> ssdpUniSock.close();
>>
>>
>>
>>
>> 2009/8/7 Survivant 00 <survivant00_at_gmail.com>
>>
>> I'm trying to do multicast over Grizzly. (client and server ..
>>> send/receive)
>>>
>>> - first.. is it possible ?
>>> - there is a sample somewhere ?
>>>
>>> Grizzly 1.x or Grizzly 2 is ok for me.
>>>
>>> maybe if we don't have multicast. There is a sample for UDP that could
>>> give the same result ?
>>>
>>
>>
>
>