# HG changeset patch # User Shinji KONO # Date 1398821647 -32400 # Node ID fc984746f9587adbe172400fb1c18119ed819c0a # Parent cdf7bbe458850f5009889002fa1759b47fca98d3 use real ip address for TreeVNC root selection diff -r cdf7bbe45885 -r fc984746f958 src/main/java/jp/ac/u_ryukyu/treevnc/client/GetDataClient.java --- 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(); diff -r cdf7bbe45885 -r fc984746f958 src/main/java/jp/ac/u_ryukyu/treevnc/client/TextBoxClient.java --- 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); } diff -r cdf7bbe45885 -r fc984746f958 src/main/java/jp/ac/u_ryukyu/treevnc/server/GetBroadCastProxy.java --- 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; } diff -r cdf7bbe45885 -r fc984746f958 src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java --- 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.