# HG changeset patch # User e085711 # Date 1310188108 -32400 # Node ID 626cf8cc002cbdebac3a7a0032417f2c4e3ffe19 # Parent 3ccedb44aaa07dc7067ed4e6b78f8776863d0046 modify MyRfbProto.java diff -r 3ccedb44aaa0 -r 626cf8cc002c src/myVncProxy/MyRfbProto.java --- a/src/myVncProxy/MyRfbProto.java Sat Jul 09 11:45:36 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Sat Jul 09 14:08:28 2011 +0900 @@ -35,7 +35,6 @@ private int rectH; private int encoding; private int zLen; - private int dataLen; private ServerSocket servSock; private int acceptPort; @@ -56,7 +55,7 @@ cliList = new LinkedList(); cliListTmp = new LinkedList(); createBimgFlag = false; - sendThreads = new LinkedList(); + // sendThreads = new LinkedList(); // executor = Executors.newCachedThreadPool(); // executor = Executors.newSingleThreadExecutor(); } @@ -66,7 +65,7 @@ cliList = new LinkedList(); cliListTmp = new LinkedList(); createBimgFlag = false; - sendThreads = new LinkedList(); + // sendThreads = new LinkedList(); // executor = Executors.newCachedThreadPool(); // executor = Executors.newSingleThreadExecutor(); } @@ -307,25 +306,7 @@ sendData(buffer); } - void readSendData() throws IOException { - byte buffer[] = new byte[dataLen]; - readFully(buffer); - reset(); - - for (Socket cli : cliList) { - try { - OutputStream out = cli.getOutputStream(); - executor.execute(new SendThread(out, buffer)); - } catch (IOException e) { - // if client socket closed - cliListTmp.remove(cli); - } catch (Exception e) { - - } - - } - } - + void regiFramebufferUpdate() throws IOException { mark(20); messageType = readU8(); @@ -341,7 +322,8 @@ reset(); } - void checkAndMark() throws IOException { + int checkAndMark() throws IOException { + int dataLen; switch (encoding) { case RfbProto.EncodingRaw: dataLen = rectW * rectH * 4 + 16; @@ -352,8 +334,35 @@ mark(dataLen); break; default: + dataLen = 1000000; mark(1000000); } + return dataLen; + } + void readSendData(int dataLen) throws IOException { + byte buffer[] = new byte[dataLen]; + readFully(buffer); + multicastqueue.put(buffer); + reset(); +/* + for (Socket cli : cliList) { + try { + OutputStream out = cli.getOutputStream(); + executor.execute(new SendThread(out, buffer)); + } catch (IOException e) { + // if client socket closed + cliListTmp.remove(cli); + } catch (Exception e) { + + } + + } +*/ + } + void sendDataToClient() throws IOException { + regiFramebufferUpdate(); + int dataLen = checkAndMark(); + readSendData(dataLen); } BufferedImage createBufferedImage(Image img) { diff -r 3ccedb44aaa0 -r 626cf8cc002c src/myVncProxy/ProxyVncCanvas.java --- a/src/myVncProxy/ProxyVncCanvas.java Sat Jul 09 11:45:36 2011 +0900 +++ b/src/myVncProxy/ProxyVncCanvas.java Sat Jul 09 14:08:28 2011 +0900 @@ -369,11 +369,11 @@ count++; - rfb.regiFramebufferUpdate(); - rfb.checkAndMark(); -// rfb.printFramebufferUpdate(); - rfb.readSendData(); - + /* + * read Data from parents and send Data to Client. + * + */ + rfb.sendDataToClient(); int bufSize = (int)rfb.getNumBytesRead(); diff -r 3ccedb44aaa0 -r 626cf8cc002c src/myVncProxy/VncCanvas.java --- a/src/myVncProxy/VncCanvas.java Sat Jul 09 11:45:36 2011 +0900 +++ b/src/myVncProxy/VncCanvas.java Sat Jul 09 14:08:28 2011 +0900 @@ -395,10 +395,12 @@ // System.out.println("\ncount=" + count); count++; - rfb.regiFramebufferUpdate(); -// rfb.printFramebufferUpdate(); - rfb.checkAndMark(); - rfb.readSendData(); + + /* + * read Data from parents and send Data to Client. + * + */ + rfb.sendDataToClient(); // rfb.printNumBytesRead(); long bufSize = rfb.getNumBytesRead();