# HG changeset patch # User e085711 # Date 1314771323 -32400 # Node ID 3bfe8845684c14f720dc555990c6c29b57096038 # Parent c76e43a12796d2cfe11abccd29d02ba46c9d1da6 modify MyVncClient diff -r c76e43a12796 -r 3bfe8845684c src/myVncClient/CuiMyVncClient.java --- a/src/myVncClient/CuiMyVncClient.java Wed Aug 31 13:34:32 2011 +0900 +++ b/src/myVncClient/CuiMyVncClient.java Wed Aug 31 15:15:23 2011 +0900 @@ -12,23 +12,6 @@ public class CuiMyVncClient implements InterfaceForViewer { - public static void main(String[] argv) { - CuiMyVncClient v = new CuiMyVncClient(); - v.echoValue = null; - v.runClient(argv, v); - - } - - private void runClient(String[] argv, CuiMyVncClient v) { - mainArgs = argv; - - host = mainArgs[0]; - port = Integer.parseInt(mainArgs[1]); - - v.init(); - v.start_threads(); - - } String[] mainArgs; String username; @@ -84,6 +67,31 @@ EchoClient echoValue; int echoPort; + String pHost; + + public static void main(String[] argv) { + CuiMyVncClient v = new CuiMyVncClient(); + v.echoValue = null; + v.runClient(argv, v); + + } + + private void runClient(String[] argv, CuiMyVncClient v) { + mainArgs = argv; + + if (mainArgs.length > 0) + pHost = mainArgs[0]; + else + pHost = "cls080.ie.u-ryukyu.ac.jp"; + if (mainArgs.length > 1) + port = Integer.parseInt(mainArgs[1]); + else + port = 5999; + + v.init(); + v.start_threads(); + + } void checkArgs(String[] argv) { @@ -295,7 +303,7 @@ showConnectionStatus("Connecting to " + host + ", port " + port + "..."); // rfb = new RfbProto(host, port, this); - rfb = new MyRfbProto(host, port); + rfb = new MyRfbProto(pHost, port); showConnectionStatus("Connected to server"); @@ -307,13 +315,13 @@ showConnectionStatus("Using RFB protocol version " + rfb.clientMajor + "." + rfb.clientMinor); + if(rfb.serverMinor == 998) { byte[] b = new byte[4]; b = rfb.readEchoPort(); echoPort = castByteInt(b); - String hs = host; - InetAddress addr = InetAddress.getByName(host); + InetAddress addr = InetAddress.getByName(pHost); String h = new String(addr.getHostAddress()); getParentName(); @@ -988,8 +996,6 @@ } public void close() { rfb.close(); - vncFrame.setVisible(false); - vncFrame.dispose(); } public void getParentName() { if (echoValue == null) { diff -r c76e43a12796 -r 3bfe8845684c src/myVncClient/MyVncClient.java --- a/src/myVncClient/MyVncClient.java Wed Aug 31 13:34:32 2011 +0900 +++ b/src/myVncClient/MyVncClient.java Wed Aug 31 15:15:23 2011 +0900 @@ -246,8 +246,7 @@ vncFrame.setVisible(false); vncFrame.dispose(); // num4 - // リーダーの子ノードがproxyに対して親が落ちたことを報告をする - if (leaderflag != null) { + if ( leaderflag != null) { while (true) { echoValue = new EchoClient(echoValue, this); echoValue.openport(); diff -r c76e43a12796 -r 3bfe8845684c src/myVncClient/WaitReply.java --- a/src/myVncClient/WaitReply.java Wed Aug 31 13:34:32 2011 +0900 +++ b/src/myVncClient/WaitReply.java Wed Aug 31 15:15:23 2011 +0900 @@ -36,6 +36,8 @@ // client.clientSocket = clientSocket; client.setClientSocket(clientSocket); client.init(); + client.setEchoValue(null); + client.getParentName(); client.start_threads(); client.start(); // MyVncClient.main(clientSocket);