Mercurial > hg > Members > nobuyasu > tightVNCClient
changeset 98:1d1bb77d871b
update
author | one |
---|---|
date | Fri, 21 Oct 2011 17:25:33 +0900 |
parents | 19aff5293769 |
children | 084adee7699b |
files | src/myVncClient/EchoClient.java src/myVncClient/MyRfbProto.java src/myVncClient/MyVncClient.java src/myVncClient/RfbProto.java src/myVncClient/WaitReply.java |
diffstat | 5 files changed, 37 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/myVncClient/EchoClient.java Fri Oct 14 17:16:20 2011 +0900 +++ b/src/myVncClient/EchoClient.java Fri Oct 21 17:25:33 2011 +0900 @@ -17,14 +17,14 @@ // MyVncClient client; private InterfaceForViewer client; private int echoPort = 9999; - IpV6 ipV6; - MyVncClient checkMove; - VncViewer vncV; + private IpV6 ipV6; + private MyVncClient checkMove; + private VncViewer vncV; String responseLine; String parent;// 親の番号 String treenum;// 自分の番号 String leaderflag;// リーダフラグ - boolean passflag; + //boolean passflag; // WaitReplyに自分自身を渡している @@ -34,10 +34,11 @@ public EchoClient(EchoClient echo) { this.name = echo.name; - leaderflag= echo.leaderflag; - parent = echo.parent; - treenum = echo.treenum; - client = echo.client; + this.leaderflag= echo.leaderflag; + this.parent = echo.parent; + this.treenum = echo.treenum; + this.client = echo.client; + this.waitReply = echo.waitReply; checkMove = (MyVncClient)echo.client; } // VncViewerから引数をもらってきてproxy役を認識する @@ -145,24 +146,29 @@ if(checkRepetition.equals("stop")){ return true; } - if(!(checkRepetition.equals("skip")) || "1".equals(leaderflag)) { + //if(!(checkRepetition.equals("skip")) || "1".equals(leaderflag)) { + if(!(waitReply.checkPath())) { Thread.sleep(1000); reConnectionMain(); streamClose(); } - Thread.sleep(1000); + //Thread.sleep(1000); + /* if(!(checkMove.vncFrame.isShowing())&&"skip".equals(checkRepetition)) { openport(); notfoundParent(); } + */ } catch (UnknownHostException e) { System.err.println("Trying to connect to unknown host: " + e); } catch (IOException e) { return false; } catch (InterruptedException e) { e.printStackTrace(); + } catch (NullPointerException e) { openport(); + System.out.println("notFoundParents"); notfoundParent(); } }
--- a/src/myVncClient/MyRfbProto.java Fri Oct 14 17:16:20 2011 +0900 +++ b/src/myVncClient/MyRfbProto.java Fri Oct 21 17:25:33 2011 +0900 @@ -152,9 +152,9 @@ // over write void writeVersionMsg() throws IOException { clientMajor = 3; - if (serverMinor >= 9) { - clientMinor = 9; - os.write(versionMsg_3_998.getBytes()); + if (serverMinor == 855) { + clientMinor = 855; + os.write(versionMsg_3_855.getBytes()); } else if (serverMajor > 3 || serverMinor >= 8) { clientMinor = 8; os.write(versionMsg_3_8.getBytes());
--- a/src/myVncClient/MyVncClient.java Fri Oct 14 17:16:20 2011 +0900 +++ b/src/myVncClient/MyVncClient.java Fri Oct 21 17:25:33 2011 +0900 @@ -26,6 +26,7 @@ EchoClient echoValue; int echoPort; String pHost; + TextBox getHost; // // main() is called when run as a java program from the command line. @@ -42,15 +43,21 @@ mainArgs = argv; inAnApplet = false; inSeparateFrame = true; + getHost = new TextBox(); if (mainArgs.length > 0) pHost = mainArgs[0]; else - pHost = "cls080.ie.u-ryukyu.ac.jp"; + getHost.ipRegister(); + pHost = getHost.getAddress(); + + + //pHost = "cls080.ie.u-ryukyu.ac.jp"; if (mainArgs.length > 1) port = Integer.parseInt(mainArgs[1]); else - port = 5999; + port = Integer.parseInt(getHost.getPort()); + //port = 5999; init(); start_threads(); @@ -153,7 +160,7 @@ System.out.println("Socket error"); // parent no find Random rnd = new Random(); - long ran = rnd.nextInt(5000) + 5000; + long ran = rnd.nextInt(3000) + 3000; System.out.println(ran); // 親がいない場合の処理はここに書く!!!! /** @@ -178,7 +185,7 @@ e1.printStackTrace(); } - if (counter >= 4) { + if (counter >= 6) { echoValue.openport(); echoValue.notfoundParent(); }
--- a/src/myVncClient/RfbProto.java Fri Oct 14 17:16:20 2011 +0900 +++ b/src/myVncClient/RfbProto.java Fri Oct 21 17:25:33 2011 +0900 @@ -33,7 +33,7 @@ class RfbProto { final static String versionMsg_3_3 = "RFB 003.003\n", - versionMsg_3_7 = "RFB 003.007\n", versionMsg_3_8 = "RFB 003.008\n"; + versionMsg_3_7 = "RFB 003.007\n", versionMsg_3_8 = "RFB 003.008\n",versionMsg_3_855 = "RFB 003.855\n"; // Vendor signatures: standard VNC/RealVNC, TridiaVNC, and TightVNC
--- a/src/myVncClient/WaitReply.java Fri Oct 14 17:16:20 2011 +0900 +++ b/src/myVncClient/WaitReply.java Fri Oct 21 17:25:33 2011 +0900 @@ -19,7 +19,11 @@ this.client = client; this.treenum = treenum; } - + + public boolean checkPath() { + return passflag; + } + public void run() { Socket clientSocket = null; ServerSocket echoServer = null; @@ -35,10 +39,10 @@ clientSocket = echoServer.accept(); if (clientSocket != null) { client.close(); + passflag = true; // client.clientSocket = clientSocket; client.setClientSocket(clientSocket); client.init(); - passflag = true; client.setEchoValue(null); client.getParentName(); client.start_threads();