changeset 240:7310e7d7a45f

add option --checkDelay.
author oc
date Sun, 12 Oct 2014 23:05:47 +0900
parents d655db005535
children b21a7842a41d
files src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/SendCheckDelay.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java
diffstat 7 files changed, 280 insertions(+), 285 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java	Sat Oct 11 23:46:22 2014 +0900
+++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java	Sun Oct 12 23:05:47 2014 +0900
@@ -40,6 +40,7 @@
 import com.glavsoft.rfb.encoding.decoder.RichCursorDecoder;
 import com.glavsoft.rfb.encoding.decoder.ZRLEESender;
 import com.glavsoft.transport.Reader;
+import com.glavsoft.viewer.TreeViewer;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -213,7 +214,7 @@
         reader.readByte(); // padding
         int numberOfRectangles = reader.readUInt16();
         
-        if(rfb.isTreeManager() && firstTime) {
+        if(rfb.isTreeManager() && firstTime && rfb.checkDelay) {
             SendCheckDelay sendCheckDelay = new SendCheckDelay(rfb);
             Thread sendCheckDelayThread = new Thread(sendCheckDelay, "send-check-delay");
             sendCheckDelayThread.start();
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/SendCheckDelay.java	Sat Oct 11 23:46:22 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/SendCheckDelay.java	Sun Oct 12 23:05:47 2014 +0900
@@ -22,12 +22,10 @@
         checkdelay.add(new CheckDelay(0, 0, 0, 0, time, EncodingType.CHECK_DELAY).getMessage());
         rfb.addSerialNumber(checkdelay);
         rfb.multicastqueue.put(checkdelay);
-        
     }
     
     public void run() {
         for (;;) {
-            System.out.println("run sendCheckDelay");
             long timeout = 50000 / 8;
             try {
                 synchronized (this) {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Sat Oct 11 23:46:22 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Sun Oct 12 23:05:47 2014 +0900
@@ -63,9 +63,8 @@
     private TreeVncRootSelectionPanel rootSelectionPanel;
     private boolean isTreeManager;
     private String vncInterface;
-    private int i;
     public LinkedList<TreeVNCNode> nodeList;
-    private SendCheckDelay sendCheckDelay;
+    public boolean checkDelay = false;
 
 
     public TreeRFBProto(boolean isTreeManager) {
@@ -182,7 +181,8 @@
                                 String address = new String(byteAddress, "UTF-8");
                                 int nodeNum = getNodeNum(port, address);
                                 Long delay = System.currentTimeMillis() - time;
-                                System.out.println("nodeNum" + nodeNum + ", delay = " + delay);
+                                double db = (double) delay / 2;
+                                System.out.println("nodeNum" + nodeNum + ", delay = " + db);
                                 
                                 // checkNodeNum();
                                 // readSendData(check);
@@ -573,21 +573,6 @@
         if (header.get(0) == FramebufferUpdate) {
             int encoding = header.getInt(12);
             
-//            sendCheckDelay.run();
-            
-
-            /*
-            if(isTreeManager()) {
-                if (i%20 == 0) {
-                    LinkedList<ByteBuffer> checkdelay = new LinkedList<ByteBuffer>();
-                    long time = System.currentTimeMillis();
-                    checkdelay.add(new CheckDelay(0, 0, 0, 0, time, EncodingType.CHECK_DELAY).getMessage());
-                    this.addSerialNumber(checkdelay);
-                    multicastqueue.put(checkdelay);
-                } i++;
-            }
-            */
-
             if (encoding == EncodingType.ZRLE.getId()
                     || encoding == EncodingType.ZLIB.getId()) {
                 // recompress into ZREE
@@ -760,7 +745,11 @@
     }
 
     public void setShowTree(boolean showTree) {
-        showTreeNode  = showTree;
+        this.showTreeNode = showTree;
+    }
+
+    public void setCheckDelay(boolean checkDelay) {
+        this.checkDelay = checkDelay;
     }
 
     public int getNodeNum(int port, String address) {
@@ -775,4 +764,4 @@
         }
         return nodeNum;
     }
-}
+}
\ No newline at end of file
--- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java	Sat Oct 11 23:46:22 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java	Sun Oct 12 23:05:47 2014 +0900
@@ -23,227 +23,227 @@
 
 public class CuiViewer implements Runnable, WindowListener, ViewerInterface {
 
-	private Logger logger;
-	private int paramsMask;
-	private boolean allowAppletInteractiveConnections;
+    private Logger logger;
+    private int paramsMask;
+    private boolean allowAppletInteractiveConnections;
 
-	public final ConnectionParams connectionParams;
-	protected String passwordFromParams;
-	boolean isSeparateFrame = true;
-	protected boolean isApplet = true;
-	private final ProtocolSettings settings;
-	protected UiSettings uiSettings;
-	private ConnectionPresenter connectionPresenter;
-	protected TreeRFBProto myRfb;
-	private boolean cuiVersion;
+    public final ConnectionParams connectionParams;
+    protected String passwordFromParams;
+    boolean isSeparateFrame = true;
+    protected boolean isApplet = true;
+    private final ProtocolSettings settings;
+    protected UiSettings uiSettings;
+    private ConnectionPresenter connectionPresenter;
+    protected TreeRFBProto myRfb;
+    private boolean cuiVersion;
     private boolean showTree = false;
     public int width;
-    public int height;    
+    public int height;
 
-	public static void main(String[] args) {
-		Parser parser = new Parser();
-		ParametersHandler.completeParserOptions(parser);
+    public static void main(String[] args) {
+        Parser parser = new Parser();
+        ParametersHandler.completeParserOptions(parser);
 
-		parser.parse(args);
-		if (parser.isSet(ParametersHandler.ARG_HELP)) {
-			printUsage(parser.optionsUsage());
-			System.exit(0);
-		}
-		CuiViewer viewer = new CuiViewer(parser);
-		SwingUtilities.invokeLater(viewer);
-	}
+        parser.parse(args);
+        if (parser.isSet(ParametersHandler.ARG_HELP)) {
+            printUsage(parser.optionsUsage());
+            System.exit(0);
+        }
+        CuiViewer viewer = new CuiViewer(parser);
+        SwingUtilities.invokeLater(viewer);
+    }
 
-	public static void printUsage(String additional) {
-		System.out
-				.println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]?n"
-						+ "    or?n"
-						+ " java -jar (progfilename) [Options]?n"
-						+ "    or?n java -jar (progfilename) -help?n    to view this help?n?n"
-						+ "Where Options are:?n"
-						+ additional
-						+ "?nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes?n"
-						+ "Both option name and option value are case insensitive.");
-	}
+    public static void printUsage(String additional) {
+        System.out
+        .println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]?n"
+                + "    or?n"
+                + " java -jar (progfilename) [Options]?n"
+                + "    or?n java -jar (progfilename) -help?n    to view this help?n?n"
+                + "Where Options are:?n"
+                + additional
+                + "?nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes?n"
+                + "Both option name and option value are case insensitive.");
+    }
 
-	public CuiViewer() {
-		logger = Logger.getLogger(getClass().getName());
-		connectionParams = new ConnectionParams();
-		settings = ProtocolSettings.getDefaultSettings();
-		uiSettings = new UiSettings();
-	}
+    public CuiViewer() {
+        logger = Logger.getLogger(getClass().getName());
+        connectionParams = new ConnectionParams();
+        settings = ProtocolSettings.getDefaultSettings();
+        uiSettings = new UiSettings();
+    }
 
-	private CuiViewer(Parser parser) {
-		this();
-		setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE
-				: parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER
-						: Level.INFO);
+    private CuiViewer(Parser parser) {
+        this();
+        setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE
+                : parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER
+                        : Level.INFO);
 
-		paramsMask = ParametersHandler.completeSettingsFromCLI(parser,
-				connectionParams, settings, uiSettings);
-		passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD);
-		logger.info("TightVNC Viewer version " + ver());
-		isApplet = false;
-	}
+        paramsMask = ParametersHandler.completeSettingsFromCLI(parser,
+                connectionParams, settings, uiSettings);
+        passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD);
+        logger.info("TightVNC Viewer version " + ver());
+        isApplet = false;
+    }
 
-	private void setLoggingLevel(Level levelToSet) {
-		final Logger appLogger = Logger.getLogger("com.glavsoft");
-		appLogger.setLevel(levelToSet);
-		ConsoleHandler ch = null;
-		for (Handler h : appLogger.getHandlers()) {
-			if (h instanceof ConsoleHandler) {
-				ch = (ConsoleHandler) h;
-				break;
-			}
-		}
-		if (null == ch) {
-			ch = new ConsoleHandler();
-			appLogger.addHandler(ch);
-		}
-		// ch.setFormatter(new SimpleFormatter());
-		ch.setLevel(levelToSet);
-	}
+    private void setLoggingLevel(Level levelToSet) {
+        final Logger appLogger = Logger.getLogger("com.glavsoft");
+        appLogger.setLevel(levelToSet);
+        ConsoleHandler ch = null;
+        for (Handler h : appLogger.getHandlers()) {
+            if (h instanceof ConsoleHandler) {
+                ch = (ConsoleHandler) h;
+                break;
+            }
+        }
+        if (null == ch) {
+            ch = new ConsoleHandler();
+            appLogger.addHandler(ch);
+        }
+        // ch.setFormatter(new SimpleFormatter());
+        ch.setLevel(levelToSet);
+    }
 
-	@Override
-	public void windowClosing(WindowEvent e) {
-		if (e != null && e.getComponent() != null) {
-			final Window w = e.getWindow();
-			if (w != null) {
-				w.setVisible(false);
-				w.dispose();
-			}
-		}
-		closeApp();
-	}
+    @Override
+    public void windowClosing(WindowEvent e) {
+        if (e != null && e.getComponent() != null) {
+            final Window w = e.getWindow();
+            if (w != null) {
+                w.setVisible(false);
+                w.dispose();
+            }
+        }
+        closeApp();
+    }
 
-	/**
-	 * Closes App(lication) or stops App(let).
-	 */
-	public void closeApp() {
-		/* nop */
-	}
+    /**
+     * Closes App(lication) or stops App(let).
+     */
+    public void closeApp() {
+        /* nop */
+    }
 
-	private boolean checkJsch() {
-		try {
-			Class.forName("com.jcraft.jsch.JSch");
-			return true;
-		} catch (ClassNotFoundException e) {
-			return false;
-		}
-	}
+    private boolean checkJsch() {
+        try {
+            Class.forName("com.jcraft.jsch.JSch");
+            return true;
+        } catch (ClassNotFoundException e) {
+            return false;
+        }
+    }
 
-	@Override
-	public void run() {
-		final boolean hasJsch = checkJsch();
-		final boolean allowInteractive = allowAppletInteractiveConnections
-				|| !isApplet;
-		connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive);
-		connectionPresenter.addModel("ConnectionParamsModel", connectionParams);
-		
+    @Override
+    public void run() {
+        final boolean hasJsch = checkJsch();
+        final boolean allowInteractive = allowAppletInteractiveConnections
+                || !isApplet;
+        connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive);
+        connectionPresenter.addModel("ConnectionParamsModel", connectionParams);
+
 
-			/*
-			 * SwingViewerWindowFactory viewerWindowFactory = new
-			 * SwingViewerWindowFactory( isSeparateFrame, isApplet, this);
-			 * 
-			 * connectionPresenter.setConnectionWorkerFactory(new
-			 * SwingConnectionWorkerFactory( connectionView.getFrame(),
-			 * passwordFromParams, connectionPresenter, viewerWindowFactory,
-			 * myRfb));
-			 */
-		
+        /*
+         * SwingViewerWindowFactory viewerWindowFactory = new
+         * SwingViewerWindowFactory( isSeparateFrame, isApplet, this);
+         * 
+         * connectionPresenter.setConnectionWorkerFactory(new
+         * SwingConnectionWorkerFactory( connectionView.getFrame(),
+         * passwordFromParams, connectionPresenter, viewerWindowFactory,
+         * myRfb));
+         */
+
 
         connectionPresenter.setConnectionWorkerFactory(
                 new SwingConnectionWorkerFactory(null, passwordFromParams, connectionPresenter, null, myRfb));
-		connectionPresenter.setCuiVersion(true);
-		connectionPresenter.startConnection(settings, uiSettings, paramsMask);
-	}
+        connectionPresenter.setCuiVersion(true);
+        connectionPresenter.startConnection(settings, uiSettings, paramsMask);
+    }
 
-	@Override
-	public void windowOpened(WindowEvent e) { /* nop */
-	}
+    @Override
+    public void windowOpened(WindowEvent e) { /* nop */
+    }
 
-	@Override
-	public void windowClosed(WindowEvent e) { /* nop */
-	}
+    @Override
+    public void windowClosed(WindowEvent e) { /* nop */
+    }
 
-	@Override
-	public void windowIconified(WindowEvent e) { /* nop */
-	}
+    @Override
+    public void windowIconified(WindowEvent e) { /* nop */
+    }
 
-	@Override
-	public void windowDeiconified(WindowEvent e) { /* nop */
-	}
+    @Override
+    public void windowDeiconified(WindowEvent e) { /* nop */
+    }
 
-	@Override
-	public void windowActivated(WindowEvent e) { /* nop */
-	}
+    @Override
+    public void windowActivated(WindowEvent e) { /* nop */
+    }
 
-	@Override
-	public void windowDeactivated(WindowEvent e) { /* nop */
-	}
+    @Override
+    public void windowDeactivated(WindowEvent e) { /* nop */
+    }
 
-	public static String ver() {
-		final InputStream mfStream = Viewer.class.getClassLoader()
-				.getResourceAsStream("META-INF/MANIFEST.MF");
-		if (null == mfStream) {
-			System.out.println("No Manifest file found.");
-			return "-1";
-		}
-		try {
-			Manifest mf = new Manifest();
-			mf.read(mfStream);
-			Attributes atts = mf.getMainAttributes();
-			return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
-		} catch (IOException e) {
-			return "-2";
-		}
-	}
+    public static String ver() {
+        final InputStream mfStream = Viewer.class.getClassLoader()
+                .getResourceAsStream("META-INF/MANIFEST.MF");
+        if (null == mfStream) {
+            System.out.println("No Manifest file found.");
+            return "-1";
+        }
+        try {
+            Manifest mf = new Manifest();
+            mf.read(mfStream);
+            Attributes atts = mf.getMainAttributes();
+            return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+        } catch (IOException e) {
+            return "-2";
+        }
+    }
 
-	public void setSocket(Socket soc) {
-		connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(), soc.getPort());
-	}
+    public void setSocket(Socket soc) {
+        connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(), soc.getPort());
+    }
 
-	public void setOpenPort(int parseInt) {
-	}
+    public void setOpenPort(int parseInt) {
+    }
 
-	public void setTeminationType(boolean b) {
-		myRfb.setTerminationType(b);
-	}
+    public void setTeminationType(boolean b) {
+        myRfb.setTerminationType(b);
+    }
 
-	public void startTreeViewer(String hostName, boolean cui) {
-		CuiViewer viewer = new CuiViewer();
-		viewer.cuiVersion = cui;
-		TreeRFBProto rfb = new TreeRFBProto(false);
-		CreateConnectionParam cp = new CreateConnectionParam(rfb);
-		if (hostName==null) {     
-		    try {
-		        cp.findTreeVncRoot();
-		    } catch (InterruptedException e) {
-		    }
-		} else {
-		    cp.setHostName(hostName);
-		}
+    public void startTreeViewer(String hostName, boolean cui) {
+        CuiViewer viewer = new CuiViewer();
+        viewer.cuiVersion = cui;
+        TreeRFBProto rfb = new TreeRFBProto(false);
+        CreateConnectionParam cp = new CreateConnectionParam(rfb);
+        if (hostName==null) {     
+            try {
+                cp.findTreeVncRoot();
+            } catch (InterruptedException e) {
+            }
+        } else {
+            cp.setHostName(hostName);
+        }
         rfb.setViewer(viewer);
-		rfb.createConnectionAndStart(this);
-		cp.sendWhereToConnect(viewer);
-		rfb.setCuiVersion(cui);
-		viewer.myRfb = rfb;
-		SwingUtilities.invokeLater(viewer);
-	}
+        rfb.createConnectionAndStart(this);
+        cp.sendWhereToConnect(viewer);
+        rfb.setCuiVersion(cui);
+        viewer.myRfb = rfb;
+        SwingUtilities.invokeLater(viewer);
+    }
 
-	public void setIsTreeVNC(boolean flag) {
-	}
+    public void setIsTreeVNC(boolean flag) {
+    }
 
-	public TreeRFBProto getRfb() {
-		return myRfb;
-	}
+    public TreeRFBProto getRfb() {
+        return myRfb;
+    }
 
-	public boolean getCuiVersion() {
-		return cuiVersion;
-	}
-	
-	public void setCuiVersion(boolean flag) {
-			// nop
-	}
+    public boolean getCuiVersion() {
+        return cuiVersion;
+    }
+
+    public void setCuiVersion(boolean flag) {
+        // nop
+    }
 
     @Override
     public void connectToParenet(int port, String hostname) throws IOException {
@@ -255,27 +255,27 @@
 
     @Override
     public void inhelitClients(ViewerInterface vncProxyService, String hostName) {
-        
+
     }
 
     @Override
-    public void proxyStart(String[] args, int width, int height, boolean showTree) {
-        
+    public void proxyStart(String[] args, int width, int height, boolean showTree, boolean checkDelay) {
+
     }
 
     @Override
     public void setNoConnection(boolean noConnection) {
-        
+
     }
 
-	@Override
-	public void setVisible(boolean b) {
-	}
+    @Override
+    public void setVisible(boolean b) {
+    }
 
-	@Override
-	public Socket getVNCSocket() {
-		return connectionPresenter.getSocket();
-	}
+    @Override
+    public Socket getVNCSocket() {
+        return connectionPresenter.getSocket();
+    }
 
     @Override
     public boolean getShowTree() {
@@ -284,7 +284,7 @@
 
     @Override
     public void setWidth(int w) {
-            width = w;
+        width = w;
     }
 
     @Override
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java	Sat Oct 11 23:46:22 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java	Sun Oct 12 23:05:47 2014 +0900
@@ -3,15 +3,16 @@
 import jp.ac.u_ryukyu.treevnc.VncProxyService;
 
 public class TreeViewer {
-	private boolean treeProxy;
-	private boolean viewer;
-	private boolean cui = false;
-	private int width; 
-	private int height;
-	private String hostName = null;
-	private boolean noConnection = false;
+    private boolean treeProxy;
+    private boolean viewer;
+    private boolean cui = false;
+    private int width; 
+    private int height;
+    private String hostName = null;
+    private boolean noConnection = false;
     private boolean permitChangeScreen = true;
     private boolean showTree = false;
+    private boolean checkDelay = false;
 
     public static void main(String[] args) {
         new TreeViewer().vncStart(args);
@@ -42,70 +43,75 @@
 
     public void rootStart(String[] args, ViewerInterface v) {
         v.setNoConnection(noConnection);  // should we accept host name here?
-        v.proxyStart(args,width,height, showTree);
+        v.proxyStart(args,width,height, showTree, checkDelay);
         v.getRfb().setHasViewer(viewer);
         if (!permitChangeScreen ) v.getRfb().setPermitChangeScreen(false);
         v.getRfb().getAcceptThread().waitForShutdown();
     }
 
-	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;
+    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.
-            	noConnection = true;
+                noConnection = true;
                 treeProxy = true;
                 viewer = true;
             } else if ("--cui".equals(args[i])) {
                 // use cui viewer 
                 cui = true;
-			} else if ("-v".equals(args[i]) || "-c".equals(args[i])) {
-				// behave as client.
-				// open display and connect to some tree node.
-				viewer = true;
-			} else if ("--version".equals(args[i])) {
-				System.out.println("version :" + Viewer.ver());
-				System.exit(0);
+            } else if ("-v".equals(args[i]) || "-c".equals(args[i])) {
+                // behave as client.
+                // open display and connect to some tree node.
+                viewer = true;
+            } else if ("--version".equals(args[i])) {
+                System.out.println("version :" + Viewer.ver());
+                System.exit(0);
             } else if ("-ns".equals(args[i])) {
                 permitChangeScreen = false;
             } else if ("--noScreenChange".equals(args[i])) {
                 permitChangeScreen = false;
             } else if ("--retina".equals(args[i])) {
-				// retina display too large for TreeVNC.
-				// restrict display size.
-				width = 1280;
-				height = 800;
-			} else if ("--width".equals(args[i])) {
-				width = Integer.parseInt(args[i+1]);
-				i++;
-			} else if ("--height".equals(args[i])) {
-				height = Integer.parseInt(args[i+1]);
-				i++;
-			} else if ("--host".equals(args[i])) {
-				hostName = args[++i];
-			} else if ("--showTree".equals(args[i])) {
-				// show Tree node.
-				showTree = true;
-			} else {
-				System.out.println("(default) TreeVNCClient\n"
-						+ "-v or -c:         View shared screen.\n"
-						+ "-p:               (proxy) Share my screen and behave as tree root.\n"
+                // retina display too large for TreeVNC.
+                // restrict display size.
+                width = 1280;
+                height = 800;
+            } else if ("--width".equals(args[i])) {
+                width = Integer.parseInt(args[i+1]);
+                i++;
+            } else if ("--height".equals(args[i])) {
+                height = Integer.parseInt(args[i+1]);
+                i++;
+            } else if ("--host".equals(args[i])) {
+                hostName = args[++i];
+            } else if ("--showTree".equals(args[i])) {
+                // show Tree node.
+                showTree = true;
+            } else if ("--checkDelay".equals(args[i])) {
+                // check delay
+                checkDelay = true;
+            } else {
+                System.out.println("(default) TreeVNCClient\n"
+                        + "-v or -c:         View shared screen.\n"
+                        + "-p:               (proxy) Share my screen and behave as tree root.\n"
                         + "-ns --noScreenChange     Viewers cannot change screen to thiers (default permite screen change)"  
-						+ "-d:               Show shared screen and behave as tree root.\n"
-						+ "-r:               Connect to fix to specified host and port.\n"
-						+ "--host hostname:  Set host name.\n"
-						+ "--retina:         Limit screen size for very large display.\n"
-						+ "--width w:        Set display width.\n"
-						+ "--height h:       Set display height.\n");
-			}
-		}
-	}
+                        + "-d:               Show shared screen and behave as tree root.\n"
+                        + "-r:               Connect to fix to specified host and port.\n"
+                        + "--host hostname:  Set host name.\n"
+                        + "--retina:         Limit screen size for very large display.\n"
+                        + "--width w:        Set display width.\n"
+                        + "--height h:       Set display height.\n"
+                        + "--showTree:       Show connected tree node.\n"
+                        + "--checkDelay:     Check speed flow of data each node.\n");
+            }
+        }
+    }
 
     public void setWidthAndHeight(ViewerInterface v) {
         if(width != 0 || height != 0) {
@@ -114,12 +120,12 @@
         }
     }	
 
-	private boolean isInteger(String num) {
-		try {
-			Integer.parseInt(num);
-			return true;
-		} catch (NumberFormatException e) {
-			return false;
-		}
-	}
+    private boolean isInteger(String num) {
+        try {
+            Integer.parseInt(num);
+            return true;
+        } catch (NumberFormatException e) {
+            return false;
+        }
+    }
 }
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java	Sat Oct 11 23:46:22 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java	Sun Oct 12 23:05:47 2014 +0900
@@ -363,7 +363,7 @@
         run();
     }
 
-    public void proxyStart(String[] argv, int width, int height, boolean showTree) {
+    public void proxyStart(String[] argv, int width, int height, boolean showTree, boolean checkDelay) {
         fbWidth = width;
         this.showTree = showTree;
         // input into arguments Decision
@@ -379,6 +379,7 @@
         TreeRFBProto rfb = new TreeRFBProto(true);
         myRfb = rfb;
         rfb.setShowTree(showTree);
+        rfb.setCheckDelay(checkDelay);
         rfb.setViewer(this);
         rfb.setCuiVersion(false);
         rfb.setHasViewer(true); // this flag will be overwrited after this method. Do we have to set here?
--- a/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java	Sat Oct 11 23:46:22 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java	Sun Oct 12 23:05:47 2014 +0900
@@ -29,7 +29,7 @@
 
     public void inhelitClients(ViewerInterface vncProxyService, String hostName);
 
-    public void proxyStart(String[] args, int width, int height, boolean showTree);
+    public void proxyStart(String[] args, int width, int height, boolean showTree, boolean checkDelay);
 
     public void setNoConnection(boolean noConnection);