users@grizzly.java.net

Re: multicast over Grizzly ?

From: Survivant 00 <survivant00_at_gmail.com>
Date: Fri, 7 Aug 2009 14:03:38 -0400

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 ?
>