changeset 60:3ccedb44aaa0

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 09 Jul 2011 11:45:36 +0900
parents a240b19b66f0 (diff) 39741f18b4f2 (current diff)
children 626cf8cc002c 925d8b3eecd5
files src/myVncProxy/MyRfbProto.java
diffstat 2 files changed, 28 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/myVncProxy/MyRfbProto.java	Fri Jul 08 18:20:35 2011 +0900
+++ b/src/myVncProxy/MyRfbProto.java	Sat Jul 09 11:45:36 2011 +0900
@@ -252,6 +252,21 @@
 		os.write(initData);
 	}
 
+	void sendData(byte b[]) {
+		try {
+			multicastqueue.put(b);
+
+			/*
+			 * // for(Socket cli : cliList){ // try{ //
+			 * cli.getOutputStream().write(b, 0, b.length); //
+			 * }catch(IOException e){ // // if socket closed //
+			 * cliList.remove(cli); // } // }
+			 */
+			// System.out.println("cliSize="+cliSize());
+		} catch (Exception e) {
+		}
+	}
+
 	void sendPngImage() {
 		try {
 			for (Socket cli : cliListTmp) {
@@ -282,13 +297,21 @@
 		System.out.println("numBytesRead=" + numBytesRead);
 	}
 
+	void bufResetSend(int size) throws IOException {
+		reset();
+		int len = size;
+		if (available() < size)
+			len = available();
+		byte buffer[] = new byte[len];
+		readFully(buffer);
+		sendData(buffer);
+	}
+
 	void readSendData() throws IOException {
 		byte buffer[] = new byte[dataLen];
 		readFully(buffer);
 		reset();
-		multicastqueue.put(buffer);
-/*
-		
+
 		for (Socket cli : cliList) {
 			try {
 				OutputStream out = cli.getOutputStream();
@@ -299,8 +322,8 @@
 			} catch (Exception e) {
 
 			}
+
 		}
-*/
 	}
 
 	void regiFramebufferUpdate() throws IOException {
@@ -409,7 +432,6 @@
 		//		addSock(newCli);
 		final Client<byte[]> c = multicastqueue.newClient();
 		Runnable sender = new Runnable() {
-			@Override
 			public void run() {
 				try {
 					// 初期接続確立の部分
--- a/src/test/MultiThreadTee.java	Fri Jul 08 18:20:35 2011 +0900
+++ b/src/test/MultiThreadTee.java	Sat Jul 09 11:45:36 2011 +0900
@@ -24,7 +24,7 @@
 
 		void put(String s) throws InterruptedException {
 			for (BlockingQueue<String> queue : clients) {
-				queue.put(s);
+				queue.offer(s);
 				
 			}