Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 139:8798f36f732b
wait for FIND_ROOT_REPLY.
author | oc |
---|---|
date | Wed, 11 Jun 2014 17:53:20 +0900 |
parents | c3761c896607 |
children | ba30010d0dd1 |
files | src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java src/main/java/jp/ac/u_ryukyu/treevnc/client/FindRoot.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/swing/ConnectionParams.java |
diffstat | 4 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Tue Jun 10 13:15:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Wed Jun 11 17:53:20 2014 +0900 @@ -20,8 +20,14 @@ public void findTreeVncRoot() throws InterruptedException { FindRoot getBcast = new FindRoot(rfb.acceptPort,this); getBcast.findRoot(); + // wait for RootSelection - wait(); + Thread runBcast = new Thread (getBcast, "TreeVNC-root-finder"); + runBcast.start(); + hostName = getBcast.textAddress(); + portNumber = Integer.parseInt(getBcast.textPort()); + getBcast.interrupt(); + } /**
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/FindRoot.java Tue Jun 10 13:15:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/FindRoot.java Wed Jun 11 17:53:20 2014 +0900 @@ -25,6 +25,7 @@ private ServerSocket server = null; private BufferedReader is; private int port; + private int port_server_socket = ConnectionParams.DEFAULT_VNC_FIND_ROOT_REPLY; private boolean stopFlag; private TreeVncRootSelectionPanel rootSelectionPanel = new TreeVncRootSelectionPanel(); private String proxyAddr; @@ -43,6 +44,7 @@ public void createSocket() { try { + server = new ServerSocket(port_server_socket); mAddr = InetAddress.getByName(TreeRootFinderListener.McastAddr); soc = new MulticastSocket(); soc.setTimeToLive(1); @@ -105,7 +107,7 @@ public void run() { try { while(!stopFlag) { - Socket socket = server.accept(); + Socket socket = server.accept(); is = new BufferedReader(new InputStreamReader( socket.getInputStream())); proxyAddr = is.readLine();
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Tue Jun 10 13:15:59 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Wed Jun 11 17:53:20 2014 +0900 @@ -70,6 +70,7 @@ private boolean noConnection; public TreeVncRootSelectionPanel rootSelectionPanel = null; + public static void main(String[] args) { Parser parser = new Parser(); ParametersHandler.completeParserOptions(parser);
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/ConnectionParams.java Tue Jun 10 13:15:59 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/ConnectionParams.java Wed Jun 11 17:53:20 2014 +0900 @@ -35,7 +35,9 @@ public static final int DEFAULT_RFB_PORT = 5900; public static final int DEFAULT_VNC_ROOT = 5950; public static final int DEFAULT_VNC_ROOT_FINDER = DEFAULT_RFB_PORT; + public static final int DEFAULT_VNC_FIND_ROOT_REPLY = 5960; + public String hostName; private int portNumber; public String sshUserName;