Mercurial > hg > Members > nobuyasu > tightVNCClient
diff src/myVncClient/CuiMyVncClient.java @ 80:3bfe8845684c
modify MyVncClient
author | e085711 |
---|---|
date | Wed, 31 Aug 2011 15:15:23 +0900 |
parents | c76e43a12796 |
children | d3e806372657 3ea33e683522 |
line wrap: on
line diff
--- 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) {