diff src/MyRfbProto.java @ 17:4eda2dbb7fef

ProxyVncCanvas version 0.2
author e085711
date Sun, 17 Apr 2011 23:59:13 +0900
parents 89e1c5f84407
children ccad9909e0e2
line wrap: on
line diff
--- a/src/MyRfbProto.java	Sun Apr 17 21:25:57 2011 +0900
+++ b/src/MyRfbProto.java	Sun Apr 17 23:59:13 2011 +0900
@@ -103,9 +103,22 @@
 			sock.getOutputStream().write(initData);
 	}
 
-	void sendData(byte b[]) throws IOException{
-		for(Socket cli : cliList)
-			cli.getOutputStream().write(b, 0, b.length);		
+//	void sendData(byte b[]) throws IOException{
+	void sendData(byte b[]){
+		try{
+			for(Socket cli : cliList){
+				try{
+					cli.getOutputStream().write(b, 0, b.length);
+				}catch(IOException e){
+					// if socket closed
+					//				cliList.remove(cli);
+					cliList.remove(cli);
+					System.out.println("cliSize="+cliSize());
+				}
+			}
+		}catch(Exception e){
+			System.out.println("cliSize 0");
+		}
 	}	
 	boolean ready() throws IOException {
 		BufferedReader br = new BufferedReader(new InputStreamReader(is));