changeset 76:70004fedb1d1

modify connectAndAuthenticate
author e085711
date Tue, 30 Aug 2011 17:36:40 +0900
parents c06a568cf092
children 42b08ecc4cb5
files src/myVncClient/CuiMyVncClient.java src/myVncClient/MyVncClient.java src/myVncClient/VncCanvas.java
diffstat 3 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/myVncClient/CuiMyVncClient.java	Tue Aug 30 16:46:23 2011 +0900
+++ b/src/myVncClient/CuiMyVncClient.java	Tue Aug 30 17:36:40 2011 +0900
@@ -309,11 +309,15 @@
 			byte[] b = new byte[4];
 			b = rfb.readEchoPort();
 			int echoPort = castByteInt(b);
-			String h = host;
+
+			InetAddress addr = InetAddress.getByName(host);
+			String h = new String(addr.getHostAddress());
+			
 			getParentname(echo, echoPort);
-			if(h.equals(host)) {
+			if(!(h.equals(host))) {
 				rfb.changeParent(host, port);
 				rfb.readVersionMsg();
+				rfb.writeVersionMsg();
 			}
 		}
 		
--- a/src/myVncClient/MyVncClient.java	Tue Aug 30 16:46:23 2011 +0900
+++ b/src/myVncClient/MyVncClient.java	Tue Aug 30 17:36:40 2011 +0900
@@ -40,8 +40,14 @@
 		inAnApplet = false;
 		inSeparateFrame = true;
 
-		host = mainArgs[0];
-		port = Integer.parseInt(mainArgs[1]);
+		if (mainArgs.length > 0)
+			host = mainArgs[0];
+		else
+			host = "cls080.ie.u-ryukyu.ac.jp";
+		if (mainArgs.length > 1)
+			port = Integer.parseInt(mainArgs[1]);
+		else
+			port = 5999;
 		
 		init();
 		start_threads();
@@ -369,11 +375,15 @@
 			byte[] b = new byte[4];
 			b = rfb.readEchoPort();
 			int echoPort = castByteInt(b);
-			String h = host;
+
+			InetAddress addr = InetAddress.getByName(host);
+			String h = new String(addr.getHostAddress());
+			
 			getParentname(echo, echoPort);
-			if(h.equals(host)) {
+			if(!(h.equals(host))) {
 				rfb.changeParent(host, port);
 				rfb.readVersionMsg();
+				rfb.writeVersionMsg();
 			}
 		}
 		
--- a/src/myVncClient/VncCanvas.java	Tue Aug 30 16:46:23 2011 +0900
+++ b/src/myVncClient/VncCanvas.java	Tue Aug 30 17:36:40 2011 +0900
@@ -395,7 +395,7 @@
 			 *  read Data from parents and send Data to Client.
 			 *  
 			 */
-//			rfb.sendDataToClient();
+			rfb.sendDataToClient();
 
 			int bufSize = (int)rfb.getNumBytesRead();