Mercurial > hg > Applications > TreeVNC
changeset 78:fc984746f958
use real ip address for TreeVNC root selection
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 30 Apr 2014 10:34:07 +0900 |
parents | cdf7bbe45885 |
children | 015321785ddf |
files | src/main/java/jp/ac/u_ryukyu/treevnc/client/GetDataClient.java src/main/java/jp/ac/u_ryukyu/treevnc/client/TextBoxClient.java src/main/java/jp/ac/u_ryukyu/treevnc/server/GetBroadCastProxy.java src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java |
diffstat | 4 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/GetDataClient.java Tue Apr 29 18:00:34 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/GetDataClient.java Wed Apr 30 10:34:07 2014 +0900 @@ -3,6 +3,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; @@ -35,13 +36,24 @@ @Override public void run() { try { - //TODO create selectPort(); server = new ServerSocket(port); while(!stopFlag) { Socket socket = server.accept(); is = new BufferedReader(new InputStreamReader( socket.getInputStream())); proxyAddr = is.readLine(); + // proxyAddr format + // 5999:localhost:localhost:133.13.59.210: + // port:hostnae:hostname:ip address: + InetAddress adr = socket.getInetAddress(); + String proxyAddr1 = adr.getHostName(); + if (proxyAddr1 != null) { + int portIndex = proxyAddr.indexOf(":"); + int restIndex = proxyAddr.indexOf(":", portIndex+1); + if (portIndex>0) { + proxyAddr = proxyAddr.substring(0, portIndex)+":"+proxyAddr1 + ":" + proxyAddr.substring(restIndex+1); + } + } if(proxyAddr!=null) text.checkBox(proxyAddr); text.setButton();
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/TextBoxClient.java Tue Apr 29 18:00:34 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/TextBoxClient.java Wed Apr 30 10:34:07 2014 +0900 @@ -31,7 +31,7 @@ private Container contentPane = getContentPane(); public TextBoxClient() { - setTitle("Informatin Connection Address"); + setTitle("TreeVNC Root Address"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/GetBroadCastProxy.java Tue Apr 29 18:00:34 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/GetBroadCastProxy.java Wed Apr 30 10:34:07 2014 +0900 @@ -68,7 +68,7 @@ private String castString(byte[] a) { String recover = new String(a); - recover = recover.replace("������n", ""); + recover = recover.replace("������n", ""); // ?? recover = recover.trim(); return recover; }
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Tue Apr 29 18:00:34 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Wed Apr 30 10:34:07 2014 +0900 @@ -29,11 +29,13 @@ } private void modeSelect(String[] args) { + viewer = true; // default for (int i = 0; i < args.length; i++) { if ("-p".equals(args[i]) || "-r".equals(args[i])) { // no display. behave as root. // relay rfb update to clients. treeProxy = true; + viewer = false; } else if ("-d".equals(args[i])) { // behave as root with display. // use this on main display such as large tv.