changeset 57:e65934744da8

update
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Fri, 29 Jul 2011 17:23:47 +0900
parents 9f8463fb1d4d
children d086ec1b4a7a
files VncViewer.jar myVncClient.jar src/myVncClient/EchoClient.java
diffstat 3 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
Binary file VncViewer.jar has changed
Binary file myVncClient.jar has changed
--- a/src/myVncClient/EchoClient.java	Thu Jul 28 18:07:21 2011 +0900
+++ b/src/myVncClient/EchoClient.java	Fri Jul 29 17:23:47 2011 +0900
@@ -119,6 +119,7 @@
 	 * Call at lost host 
 	 */
 	boolean losthost() {
+		String checkRepetition; 
 		if (echoSocket != null && os != null && is != null) {
 			try {
 				if(runflag){
@@ -126,9 +127,9 @@
 				}
 				// echoSocketの情報を呼び出す
 				if ("1".equals(leaderflag)) {
-					senddataProxy("1",parent);
+					senddataProxy("1",parent,treenum);
 				} else {
-					senddataProxy("3",parent);
+					senddataProxy("3",parent,treenum);
 				}
 
 				if ((responseLine = is.readLine()) != null) {
@@ -137,8 +138,12 @@
 				if ((parent = is.readLine()) != null) {
 					System.out.println("parent: " + parent);
 				}
-				
-				
+				if ((checkRepetition = is.readLine()) != null) {
+					System.out.println("checkRepetition: " + checkRepetition);
+				}
+				if(checkRepetition.equals("stop")){
+					return true;
+				}
 					
 				/**     
 				 * if ((value.treenum = is.readLine()) != null) {
@@ -195,7 +200,7 @@
 		if (echoSocket != null && os != null && is != null) {
 			runflag = true;
 			try {
-				senddataProxy("2", parent);
+				senddataProxy("2", parent,null);
 
 				if ((responseLine = is.readLine()) != null) {
 					System.out.println("Server: " + responseLine);
@@ -292,10 +297,16 @@
 		return this;
 	}
 	
-	void senddataProxy(String type,String num) {
+	void senddataProxy(String type,String num,String treenum) {
 		try {
-			os.writeBytes(type + "\n");
-			os.writeBytes(num + "\n");
+			if(treenum!=null) {
+				os.writeBytes(type + "\n");
+				os.writeBytes(num + "\n");
+				os.writeBytes(treenum + "\n");
+			} else {
+				os.writeBytes(type + "\n");
+				os.writeBytes(num + "\n");
+			}
 
 		} catch (UnknownHostException e) {
 			System.err.println("Trying to connect to unknown host: " + e);