Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 513:b97fdcd337fe
fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 20 Feb 2019 23:04:41 +0900 |
parents | 16f9b37ef43b |
children | 887ebd993b3d |
files | src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java src/main/java/jp/ac/u_ryukyu/treevnc/FindRoot.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java |
diffstat | 5 files changed, 24 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Wed Feb 20 15:49:28 2019 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Wed Feb 20 23:04:41 2019 +0900 @@ -1,13 +1,10 @@ package jp.ac.u_ryukyu.treevnc; -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; - import com.glavsoft.viewer.ViewerInterface; import com.glavsoft.viewer.swing.ConnectionParams; public class CreateConnectionParam { + private final FindRoot getBcast; private String hostName; private int portNumber = ConnectionParams.DEFAULT_VNC_ROOT; @@ -21,7 +18,7 @@ this.rfb = rfb; rfb.setConnectionParam(this); getBcast = new FindRoot(rfb.acceptPort,this); - rfb.setFindRoot(getBcast); + rfb.setFindRoot(); } public synchronized void findTreeVncRoot() { @@ -94,4 +91,9 @@ public synchronized void restart() { notify(); } + + public FindRoot getFindRoot() { + return getBcast; + } + }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/FindRoot.java Wed Feb 20 15:49:28 2019 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/FindRoot.java Wed Feb 20 23:04:41 2019 +0900 @@ -38,6 +38,10 @@ } } + public FindRoot(int port, MulticastSocket soc) { + this.port = port; + this.soc = soc; + } /** * send find root message.
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Wed Feb 20 15:49:28 2019 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Wed Feb 20 23:04:41 2019 +0900 @@ -12,7 +12,6 @@ import com.glavsoft.viewer.ViewerInterface; import com.glavsoft.viewer.swing.ConnectionParams; -import java.awt.*; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; @@ -22,7 +21,6 @@ import java.util.Enumeration; import java.util.Iterator; import java.util.LinkedList; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.DataFormatException; import java.util.zip.Deflater; @@ -1038,7 +1036,9 @@ this.sharingId = sharingId; } - public void setFindRoot(FindRoot findRoot) { - this.findRoot = findRoot; + public void setFindRoot() { + if (getCast!=null) { + findRoot = new FindRoot(acceptPort,getCast.getSocket()); + } } } \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java Wed Feb 20 15:49:28 2019 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRootFinderListener.java Wed Feb 20 23:04:41 2019 +0900 @@ -26,6 +26,12 @@ public TreeRootFinderListener(ViewerInterface vncProxyService) { vps = vncProxyService; + try { + soc = createMulticastSocket(); + System.out.println("FindRoot listening on "+ InetAddress.getByName(McastAddr)); + } catch (IOException e) { + e.printStackTrace(); + } } public static MulticastSocket createMulticastSocket() throws IOException { @@ -50,8 +56,6 @@ private void replyToRootSearchMulticast() { byte[] buf = new byte[BufSize]; try { - soc = createMulticastSocket(); - System.out.println("FindRoot listening on "+ InetAddress.getByName(McastAddr)); DatagramPacket recvPacket = new DatagramPacket(buf, BufSize); while (!stopFlag) {
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Wed Feb 20 15:49:28 2019 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Wed Feb 20 23:04:41 2019 +0900 @@ -32,6 +32,7 @@ import com.glavsoft.viewer.swing.ParametersHandler; import com.glavsoft.viewer.swing.SwingViewerWindow; import jp.ac.u_ryukyu.treevnc.CreateConnectionParam; +import jp.ac.u_ryukyu.treevnc.FindRoot; import jp.ac.u_ryukyu.treevnc.TreeRFBProto; import javax.swing.*; @@ -377,7 +378,7 @@ connectionPresenter1.setRetinaScale(scale); connectionPresenter1.setMulticast(connectionPresenter.isUseMulticast()); // System.out.println("Sarver change accepted from id :" + newVNCServerId); - return connectionPresenter; + return connectionPresenter1; } /** @@ -394,7 +395,6 @@ cp.setHostName(hostName); } else { cp.findTreeVncRoot(); - // selected "Start Display Mode" or "Start as TreeVNC Root" for start selection panel if (cp.isDisplayMode() || cp.isRootMode()) { myRfb = rfb; @@ -445,6 +445,7 @@ } else { myRfb.startTreeRootFindThread(); } + myRfb.setFindRoot(); setIsTreeVNC(true); if (hostName == null) { hostName = "localhost";