Mercurial > hg > Applications > TreeVNC
changeset 259:606953a43198
fix how to join Multicast for the IPv6 address.
author | oc |
---|---|
date | Mon, 01 Dec 2014 22:29:59 +0900 |
parents | fbd792d91055 |
children | 847f2ed2a757 |
files | src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeVNCNetwork.java |
diffstat | 2 files changed, 8 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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();
--- 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()); } }