# HG changeset patch # User oc # Date 1418022564 -32400 # Node ID 4075f68f1c910d8a6009be892249c0080b7ebee1 # Parent 7d8f45cadd89572a5ecc638b7d603aa437f50b8e add joinGroup IPv6 and IPv4 adderss version. diff -r 7d8f45cadd89 -r 4075f68f1c91 src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java Mon Dec 08 04:48:23 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java Mon Dec 08 16:09:24 2014 +0900 @@ -9,7 +9,10 @@ import com.glavsoft.viewer.swing.ConnectionParams; public class TreeRootFinderListener implements Runnable { - public static final String McastAddr = "FF02::1"; + public static final String Ipv4McastAddr = "224.0.0.1"; + public static final String Ipv6McastAddr = "FF02::1"; + public static String McastAddr = Ipv4McastAddr; + static final int BufSize = 1024; private boolean stopFlag = false; private ViewerInterface vps; @@ -27,10 +30,14 @@ private void replyToRootSearchMulticast() { byte[] buf = new byte[BufSize]; try { - InetAddress mAddr = InetAddress.getByName(McastAddr); soc = new MulticastSocket(ConnectionParams.DEFAULT_VNC_ROOT_FINDER); - SocketAddress socAdd = new InetSocketAddress(mAddr, 5900); - soc.joinGroup(socAdd, null); + try { + soc.joinGroup(InetAddress.getByName(McastAddr)); + } catch (SocketException e) { + soc.joinGroup(InetAddress.getByName(Ipv6McastAddr)); + McastAddr = Ipv6McastAddr; + } + DatagramPacket recvPacket = new DatagramPacket(buf, BufSize); while (!stopFlag) { soc.receive(recvPacket); diff -r 7d8f45cadd89 -r 4075f68f1c91 src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommandChannelListener.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommandChannelListener.java Mon Dec 08 04:48:23 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommandChannelListener.java Mon Dec 08 16:09:24 2014 +0900 @@ -100,7 +100,7 @@ * initial connection of RFB protocol */ InetAddress adr = connection.getLocalAddress(); - String myHostAddress =adr .getHostAddress(); + String myHostAddress = adr.getHostAddress(); String intf = NetworkInterface.getByInetAddress(adr).getName(); sendRfbVersion(os); byte[] b;