Mercurial > hg > Members > nobuyasu > tightVNCClient
changeset 49:a9e0284cc29c
modify echoClient.java and MyVncClient.java
author | Yu Taninari <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 12 Jul 2011 13:41:54 +0900 |
parents | 67655ba93e92 |
children | c07bec8c8617 |
files | src/myVncClient/MyVncClient.java src/myVncClient/echoClient.java |
diffstat | 2 files changed, 31 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/myVncClient/MyVncClient.java Mon Jul 11 14:39:24 2011 +0900 +++ b/src/myVncClient/MyVncClient.java Tue Jul 12 13:41:54 2011 +0900 @@ -122,7 +122,7 @@ Random rnd = new Random(); long ran = rnd.nextInt(5000) + 5000; System.out.println(ran); - + echoClient.runflag = false; while (true) { try { Thread.sleep(ran); @@ -133,6 +133,9 @@ echo = new echoClient(); echo.openport(); echo.losthost(); + if(echoClient.runflag==true){ + break; + } } // System.exit(0);
--- a/src/myVncClient/echoClient.java Mon Jul 11 14:39:24 2011 +0900 +++ b/src/myVncClient/echoClient.java Tue Jul 12 13:41:54 2011 +0900 @@ -5,17 +5,19 @@ import java.util.Random; public class echoClient { - public static Revalue value = new Revalue(); + static Revalue value = new Revalue(); + static String name; + static BufferedReader is = null; + static DataOutputStream os = null; + static Socket echoSocket = null; + static boolean runflag = false; WaitReply waitReply;// = new WaitReply(); String responseLine, treenum, parent, line; - public static Socket echoSocket = null; - BufferedReader lostis = null; - public static DataOutputStream os = null; - PrintStream lostos; - public static BufferedReader is = null; + BufferedReader lostis = null;//あとで修正する + PrintStream lostos;//あとで修正する Socket clientSocket = null; ServerSocket echoServer = null; - public static String name; + @@ -153,11 +155,28 @@ os.close(); is.close(); echoSocket.close(); + runflag = true; } catch (UnknownHostException e) { System.err.println("Trying to connect to unknown host: " + e); } catch (IOException e) { - System.err.println("IOException: " + e); + runflag = false; + while (true) { + try { + Thread.sleep(1000); + System.out.println("once connection proxy"); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + openport(); + losthost(); + System.out.println("faild in this area"); + System.err.println("IOException: " + e); + if(runflag == true){ + break; + } + } } catch (InterruptedException e) { // TODO Auto-generated catch block in order to thread sleep