# HG changeset patch # User e085711 # Date 1303052353 -32400 # Node ID 4eda2dbb7fefd94e9de62d2f87d8c2258dbcbec6 # Parent 549229fd7288b10a94847a55b70e5b017a6cb13e ProxyVncCanvas version 0.2 diff -r 549229fd7288 -r 4eda2dbb7fef src/MyRfbProto.java --- 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)); diff -r 549229fd7288 -r 4eda2dbb7fef src/ProxyVncCanvas.java --- a/src/ProxyVncCanvas.java Sun Apr 17 21:25:57 2011 +0900 +++ b/src/ProxyVncCanvas.java Sun Apr 17 23:59:13 2011 +0900 @@ -349,7 +349,7 @@ rfb.initServSock(5550); // single thread - /* +/* try { // rfb.setSoTimeout(1000); Socket newCli = rfb.accept(); @@ -358,10 +358,11 @@ } catch (IOException e) { } */ + // multi thread Thread accept = new Thread(new acceptThread(rfb)); accept.start(); - + while (true) { @@ -376,7 +377,7 @@ System.out.println("encoding=" + encoding); rfb.reset(); - rfb.mark(rfb.available()); + rfb.mark(10000000); rfb.printNumBytesRead(); int bufSize = (int)rfb.getNumBytesRead(); diff -r 549229fd7288 -r 4eda2dbb7fef src/VncCanvas.java --- a/src/VncCanvas.java Sun Apr 17 21:25:57 2011 +0900 +++ b/src/VncCanvas.java Sun Apr 17 23:59:13 2011 +0900 @@ -417,6 +417,7 @@ rfb.reset(); // rfb.mark(rfb.available()); + rfb.mark(1000000); System.out.println("rfb.available()="+rfb.available()); rfb.printNumBytesRead(); @@ -574,7 +575,7 @@ bufSize = rfb.getNumBytesRead() - bufSize; System.out.println("bufSize="+bufSize); -// rfb.bufResetSend((int)bufSize); + rfb.bufResetSend((int)bufSize); if(rfb.available() < bufSize){ System.out.println("rfb.available() < bufSize");