Mercurial > hg > Members > nobuyasu > tightVNCClient
changeset 34:76f5994f2af2
modfy MyVncClient.java
author | e085711 |
---|---|
date | Thu, 07 Jul 2011 18:12:46 +0900 |
parents | 241f95cf0c0c |
children | b3c9be50ef89 |
files | src/myVncClient/MyRfbProto.java src/myVncClient/MyVncClient.java src/myVncClient/VncCanvas.java src/myVncClient/echoClient.java src/myVncClient/waitreply.java |
diffstat | 5 files changed, 21 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/myVncClient/MyRfbProto.java Thu Jul 07 16:04:40 2011 +0900 +++ b/src/myVncClient/MyRfbProto.java Thu Jul 07 18:12:46 2011 +0900 @@ -43,6 +43,8 @@ private LinkedList <Thread> sendThreads; boolean createBimgFlag; + echoClient echo; + ExecutorService executor; @@ -248,6 +250,14 @@ try{ cli.getOutputStream().write(b, 0, b.length); }catch(IOException e){ + //insert + + System.out.println("lostchild"); + if("1".equals(echoClient.value.leaderflag)){ + echo = new echoClient(); + echo.openport(); + echo.lostchild(); + } // if socket closed cliList.remove(cli); }
--- a/src/myVncClient/MyVncClient.java Thu Jul 07 16:04:40 2011 +0900 +++ b/src/myVncClient/MyVncClient.java Thu Jul 07 18:12:46 2011 +0900 @@ -170,6 +170,9 @@ } catch (EOFException e) { // insert + //window を消してnullを突っ込んでGCで削除させる。 + vncFrame.setVisible(false); + vncFrame = null; // リーダーの子ノードがproxyに対して親が落ちたことを報告をする if ("1".equals(echoClient.value.leaderflag)) { echo = new echoClient(); @@ -661,16 +664,10 @@ * port = readIntParameter("PORT", 5550); */ - if (mainArgs.length > 0) - host = mainArgs[0]; - else - host = "cls080.ie.u-ryukyu.ac.jp"; - if (value == null) { if (clientSocket == null) { echo = new echoClient(host); echo.openport(); - // value = echo.hostn(mainArgs[0]); value = echo.hostn("1"); } else { echo = new echoClient(); @@ -773,7 +770,7 @@ } return s; } - +/* for (int i = 0; i < mainArgs.length; i += 2) { if (mainArgs[i].equalsIgnoreCase(name)) { try { @@ -786,6 +783,7 @@ } } } +*/ if (required) { fatalError(name + " parameter not specified"); } @@ -1023,6 +1021,7 @@ v.inSeparateFrame = true; v.init(null); + v.start_threads(); v.start(); } @@ -1034,6 +1033,7 @@ v.inSeparateFrame = true; v.init(value); + v.start_threads(); v.start(); }
--- a/src/myVncClient/VncCanvas.java Thu Jul 07 16:04:40 2011 +0900 +++ b/src/myVncClient/VncCanvas.java Thu Jul 07 18:12:46 2011 +0900 @@ -384,10 +384,6 @@ long count = 0; -/* - Thread accept = new Thread(new acceptThread(rfb)); - accept.start(); -*/ while (true) { // System.out.println("\ncount=" + count);
--- a/src/myVncClient/echoClient.java Thu Jul 07 16:04:40 2011 +0900 +++ b/src/myVncClient/echoClient.java Thu Jul 07 18:12:46 2011 +0900 @@ -32,7 +32,7 @@ void openport(){ // ソケットや入出力用のストリームの宣言 - // ポート9999番を開く + // ポート9999番に接続 try { if(name != null){ echoSocket = new Socket(name, 9999); @@ -151,6 +151,7 @@ Thread.sleep(1000); MyVncClient.main(value); + // 開いたソケットなどをクローズ os.close(); is.close();
--- a/src/myVncClient/waitreply.java Thu Jul 07 16:04:40 2011 +0900 +++ b/src/myVncClient/waitreply.java Thu Jul 07 18:12:46 2011 +0900 @@ -8,7 +8,7 @@ echoClient echo; Socket clientSocket = null; ServerSocket echoServer=null; - + boolean mainFlag; waitreply(echoClient _echo){ echo = _echo; @@ -29,6 +29,7 @@ MyVncClient.main(clientSocket); //echo.Interruption(clientSocket); } + }catch (IOException e){ System.out.println(e); }