changeset 2:5d72f4c7371d

befor change
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Sat, 07 Apr 2012 14:55:34 +0900
parents 1d5cebe3bca0
children 3b341997141a
files src/treeVnc/AcceptClient.java src/treeVnc/CuiMyVncClient.java src/treeVnc/EchoClient.java src/treeVnc/MyRfbProtoClient.java src/treeVnc/MyRfbProtoProxy.java src/treeVnc/MyVncClient.java src/treeVnc/RfbProto.java src/treeVnc/VncCanvas.java
diffstat 8 files changed, 68 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/treeVnc/AcceptClient.java	Thu Feb 23 16:18:42 2012 +0900
+++ b/src/treeVnc/AcceptClient.java	Sat Apr 07 14:55:34 2012 +0900
@@ -276,6 +276,7 @@
 		} else if (numberZone == ((treeNum - 1) / treebranch)) {
 			if (++passNumber == treebranch) {
 				System.out.println(treeNum + "--notify--");
+				notifyAll();
 				passNumber = 0;
 				replyNormalChildren(os,is,port,String.valueOf(treeNum),true);
 			} else {
--- a/src/treeVnc/CuiMyVncClient.java	Thu Feb 23 16:18:42 2012 +0900
+++ b/src/treeVnc/CuiMyVncClient.java	Sat Apr 07 14:55:34 2012 +0900
@@ -202,7 +202,7 @@
 
 				if (counter >= 3) {
 					echoValue.openport();
-					echoValue.notfoundParent();
+					echoValue.notFoundParent();
 				}
 
 				echoValue.openport();
--- a/src/treeVnc/EchoClient.java	Thu Feb 23 16:18:42 2012 +0900
+++ b/src/treeVnc/EchoClient.java	Sat Apr 07 14:55:34 2012 +0900
@@ -166,13 +166,13 @@
 			} catch (NullPointerException e) {
 				openport();
 				System.out.println("notFoundParents");
-				notfoundParent();
+				notFoundParent();
 			}
 		}
 		return true;
 	}
 
-	boolean notfoundParent() {
+	boolean notFoundParent() {
 		if (echoSocket != null && os != null && is != null) {
 			runflag = true;
 			try {
--- a/src/treeVnc/MyRfbProtoClient.java	Thu Feb 23 16:18:42 2012 +0900
+++ b/src/treeVnc/MyRfbProtoClient.java	Sat Apr 07 14:55:34 2012 +0900
@@ -454,7 +454,7 @@
 	
 	
 	void regiFramebufferUpdate() throws IOException {
-		mcastStart();
+		//mcastStart();
 		is.mark(20);
 		messageType = readU8();   // 0
 		skipBytes(1);                    // 1
@@ -835,7 +835,7 @@
 
 	public void newClient(AcceptThread acceptThread, final Socket newCli,
 			final OutputStream os, final InputStream is) throws IOException {
-		mcastStart();
+		//mcastStart();
 		// createBimgFlag = true;
 		// rfb.addSockTmp(newCli);
 		//		addSock(newCli);
--- a/src/treeVnc/MyRfbProtoProxy.java	Thu Feb 23 16:18:42 2012 +0900
+++ b/src/treeVnc/MyRfbProtoProxy.java	Sat Apr 07 14:55:34 2012 +0900
@@ -415,15 +415,25 @@
 	}
 
 	void regiFramebufferUpdate() throws IOException {
+
 		is.mark(20);
 		messageType = readU8(); // 0
 		skipBytes(1); // 1
+
 		rectangles = readU16(); // 2
 		rectX = readU16(); // 4
 		rectY = readU16(); // 6
 		rectW = readU16(); // 8
 		rectH = readU16(); // 10
+/*
+		readU16(); // 2
+		readU16(); // 4
+		readU16(); // 6
+		readU16(); // 8
+		readU16(); // 10
+*/		
 		encoding = readU32(); // 12
+
 		// System.out.println("encoding = "+encoding);
 		if (encoding == EncodingZRLE || encoding == EncodingZRLEE
 				|| encoding == EncodingZlib)
@@ -432,7 +442,6 @@
 			zLen = 0;
 		//System.out.println(zLen);
 		is.reset();
-
 	}
 
 	int checkAndMark() throws IOException {
@@ -476,7 +485,7 @@
 
 	void sendDataToClient() throws Exception {
 		regiFramebufferUpdate();
-		printFramebufferUpdate();
+		//printFramebufferUpdate();
 		int dataLen = checkAndMark();
 		readSendData(dataLen);
 	}
@@ -539,6 +548,13 @@
 		 * System.out.println("rectX = "+rectX+": rectY = "+rectY);
 		 * System.out.println("rectW = "+rectW+": rectH = "+rectH);
 		 */
+		
+		 System.out.println("messageType=" + messageType);
+		 System.out.println("rectangles=" + rectangles);
+		 System.out.println("encoding=" + encoding);
+		 System.out.println("rectX = "+rectX+": rectY = "+rectY);
+		 System.out.println("rectW = "+rectW+": rectH = "+rectH);
+
 		switch (encoding) {
 		case RfbProto.EncodingRaw:
 			System.out.println("rectW * rectH * 4 + 16 =" + rectW * rectH * 4
@@ -757,8 +773,19 @@
 				readFully(len.array(), 0, 4);
 				len.limit(4);
 				ByteBuffer inputData = ByteBuffer.allocate(dataLen - 20);
-
+				
 				startTiming();
+				
+				/*
+				if(inputData.capacity()>64000) {
+					System.out.println("rectW = "+rectW+": rectH = "+rectH);
+					System.out.println("--------------------------------");
+				}
+				*/
+				
+				//System.out.println("DataLength"+inputData.capacity());
+				//System.out.println("rectW*rextdH"+rectW*rectH);
+				
 				readFully(inputData.array(), 0, inputData.capacity());
 				//System.out.println(dataLen);
 				inputData.limit(dataLen - 20);
@@ -782,7 +809,7 @@
 				bufs.addFirst(blen);
 
 				bufs.addFirst(header);
-				if(dataLen<=64000)
+				//if(dataLen<=64000)
 					multicastqueue.put(bufs);
 				// is.reset();
 
@@ -979,8 +1006,8 @@
 					throws IOException {
 				while (inputIndex < bufs.size()) {
 					ByteBuffer b = bufs.get(inputIndex++);
-					broadCastCommunication(b.array(),b.limit()-b.position());
-//					os.write(b.array(), b.position(), b.limit());
+//					broadCastCommunication(b.array(),b.limit()-b.position());
+					os.write(b.array(), b.position(), b.limit());
 				}
 				os.flush();
 			}
--- a/src/treeVnc/MyVncClient.java	Thu Feb 23 16:18:42 2012 +0900
+++ b/src/treeVnc/MyVncClient.java	Sat Apr 07 14:55:34 2012 +0900
@@ -235,7 +235,7 @@
 
 				if (counter >= 3) {
 					echoValue.openport();
-					echoValue.notfoundParent();
+					echoValue.notFoundParent();
 				}
 
 				echoValue.openport();
--- a/src/treeVnc/RfbProto.java	Thu Feb 23 16:18:42 2012 +0900
+++ b/src/treeVnc/RfbProto.java	Sat Apr 07 14:55:34 2012 +0900
@@ -28,9 +28,11 @@
 import java.io.*;
 import java.awt.event.*;
 import java.net.Socket;
+import java.nio.ByteBuffer;
+import java.util.LinkedList;
 import java.util.zip.*;
 
-class RfbProto {
+public 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_855 = "RFB 003.855\n";
@@ -1368,14 +1370,30 @@
 		readFully(b, 0, b.length);
 	}
 
-	long before = System.currentTimeMillis();
+	long before = System.currentTimeMillis(); 
 	public void readFully(byte b[], int off, int len) throws IOException {
-		long before = 0;
+//		long before = 0;
 		if (timing)
 			before = System.currentTimeMillis();
 
 		is.readFully(b, off, len);
+		
+		/*
+		if(b.length==16) {
+			b[4] = (byte)0;
+			b[5] = (byte)0;
+			b[6] = (byte)0;
+			b[7] = (byte)0;
+			System.out.println("----------------------");
+		}
+		*/
+				//System.out.println("Blength:"+b.length);
+		//for(int i=0 ; i<=b.length ; i++) { 
+			//if(i>b.length/2)
+				//b[i] = 10;
+		//}
 
+		/*
 		if (timing) {
 			long after = System.currentTimeMillis();
 			long newTimeWaited = (after - before) * 10;
@@ -1392,8 +1410,9 @@
 			timedKbits += newKbits;
 			before = after;
 		}
-
+	*/
 		numBytesRead += len;
+		//System.out.println("numBytesRead:"+numBytesRead);
 	}
 
 	final int available() throws IOException {
@@ -1426,4 +1445,9 @@
 		numBytesRead += 4;
 		return r;
 	}
+
+	public LinkedList<ByteBuffer> blockingUpdateRectangle(ByteBuffer input,int w,int h) {
+
+		return null;
+	}
 }
--- a/src/treeVnc/VncCanvas.java	Thu Feb 23 16:18:42 2012 +0900
+++ b/src/treeVnc/VncCanvas.java	Sat Apr 07 14:55:34 2012 +0900
@@ -1018,7 +1018,6 @@
 				/*
  				 * dst[i] = (0x00 << 16 | 0x00 << 8 | 0xFF);
 				 */
-
 			}
 		}
 	}