# HG changeset patch # User oc # Date 1417440599 -32400 # Node ID 606953a431982f89cbbd81cc5ab8179d4f0fa839 # Parent fbd792d91055a31ed09268ed095c65b02c77928d fix how to join Multicast for the IPv6 address. diff -r fbd792d91055 -r 606953a43198 src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java Mon Dec 01 17:06:36 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java Mon Dec 01 22:29:59 2014 +0900 @@ -1,10 +1,8 @@ package jp.ac.u_ryukyu.treevnc; import java.io.IOException; -import java.net.DatagramPacket; -import java.net.InetAddress; -import java.net.MulticastSocket; -import java.net.UnknownHostException; +import java.net.*; +import java.lang.SecurityManager; import com.glavsoft.rfb.protocol.ProtocolContext.TreeCommand; import com.glavsoft.viewer.ViewerInterface; @@ -16,6 +14,7 @@ private boolean stopFlag = false; private ViewerInterface vps; private MulticastSocket soc; + private SecurityManager securityManager; public TreeRootFinderListener(ViewerInterface vncProxyService) { vps = vncProxyService; @@ -30,13 +29,10 @@ try { InetAddress mAddr = InetAddress.getByName(McastAddr); soc = new MulticastSocket(ConnectionParams.DEFAULT_VNC_ROOT_FINDER); - DatagramPacket recvPacket = new DatagramPacket(buf, BufSize); - try { - soc.joinGroup(mAddr); - } catch (Exception e) { - // Ignore case of a network interface don't have corresponding to the Multicast. - } - while (!stopFlag) { + SocketAddress socAdd = new InetSocketAddress(mAddr, 5900); + soc.joinGroup(socAdd, null); + DatagramPacket recvPacket = new DatagramPacket(buf, BufSize); + while (!stopFlag) { soc.receive(recvPacket); String hostname = recvPacket.getAddress().getHostAddress(); byte[] reply = recvPacket.getData(); diff -r fbd792d91055 -r 606953a43198 src/main/java/jp/ac/u_ryukyu/treevnc/TreeVNCNetwork.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVNCNetwork.java Mon Dec 01 17:06:36 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVNCNetwork.java Mon Dec 01 22:29:59 2014 +0900 @@ -37,7 +37,7 @@ netaddr[i] &= netmask[i]; } treeManager.setNetMask(netmask,netaddr); - addNetworkInterface(ni, treeManager); + addNetworkInterface(ni, treeManager); System.out.println("Interfaces :" + ni.getName()); } }