# HG changeset patch # User e085711 # Date 1303199187 -32400 # Node ID ccad9909e0e2d8caf50ae81c7f822bb9c0b8889c # Parent 4eda2dbb7fefd94e9de62d2f87d8c2258dbcbec6 raw only version diff -r 4eda2dbb7fef -r ccad9909e0e2 src/MyRfbProto.java --- a/src/MyRfbProto.java Sun Apr 17 23:59:13 2011 +0900 +++ b/src/MyRfbProto.java Tue Apr 19 16:46:27 2011 +0900 @@ -8,6 +8,10 @@ class MyRfbProto extends RfbProto { + private int messageType; + private int rectangles; + private int encoding; + private ServerSocket servSock; private byte initData[]; private LinkedList cliList; @@ -41,13 +45,11 @@ void mark(int len) throws IOException { is.mark(len); - System.out.println("is.mark"); } void reset() throws IOException { is.reset(); - System.out.println("is.reset"); - } + } boolean markSupported() { return is.markSupported(); @@ -113,9 +115,9 @@ // if socket closed // cliList.remove(cli); cliList.remove(cli); - System.out.println("cliSize="+cliSize()); } } + System.out.println("cliSize="+cliSize()); }catch(Exception e){ System.out.println("cliSize 0"); } @@ -136,15 +138,25 @@ int len = size; if(available() < size ) len = available(); - System.out.println("len="+len); byte buffer[] = new byte[len]; readFully(buffer); sendData(buffer); } - void resetNumBytesRead(){ - numBytesRead = 0; + void regiFramebufferUpdate()throws IOException{ + mark(16); + messageType = readU8(); + skipBytes(1); + rectangles = readU16(); + skipBytes(8); + encoding = readU32(); + reset(); } - + void printFramebufferUpdate(){ + + System.out.println("messageType=" + messageType); + System.out.println("rectangles="+rectangles); + System.out.println("encoding=" + encoding); + } } diff -r 4eda2dbb7fef -r ccad9909e0e2 src/ProxyVncCanvas.java --- a/src/ProxyVncCanvas.java Sun Apr 17 23:59:13 2011 +0900 +++ b/src/ProxyVncCanvas.java Tue Apr 19 16:46:27 2011 +0900 @@ -369,17 +369,11 @@ System.out.println("\ncount=" + count); count++; - rfb.mark(16); - int mesageType = rfb.readU8(); - System.out.println("mesageType=" + mesageType); - rfb.skipBytes(11); - int encoding = rfb.readU32(); - System.out.println("encoding=" + encoding); - rfb.reset(); - + rfb.regiFramebufferUpdate(); + rfb.printFramebufferUpdate(); + rfb.mark(10000000); - rfb.printNumBytesRead(); int bufSize = (int)rfb.getNumBytesRead(); // Read message type from the server. @@ -440,7 +434,6 @@ case RfbProto.EncodingRaw: statNumRectsRaw++; handleRawRect(rx, ry, rw, rh); - rfb.printNumBytesRead(); break; case RfbProto.EncodingCopyRect: statNumRectsCopy++; @@ -534,6 +527,7 @@ throw new Exception("Unknown RFB message type " + msgType); } bufSize = (int)rfb.getNumBytesRead() - bufSize; + System.out.println("bufSize="+bufSize); rfb.bufResetSend(bufSize); } } diff -r 4eda2dbb7fef -r ccad9909e0e2 src/VncCanvas.java --- a/src/VncCanvas.java Sun Apr 17 23:59:13 2011 +0900 +++ b/src/VncCanvas.java Tue Apr 19 16:46:27 2011 +0900 @@ -401,26 +401,13 @@ count++; System.out.println("ready rfb.available()="+rfb.available()); - rfb.mark(20); - int messageType = rfb.readU8(); - System.out.println("messageType=" + messageType); - rfb.skipBytes(1); - int rect = rfb.readU16(); - System.out.println("rectangles="+rect); - rfb.skipBytes(8); - int encoding = rfb.readU32(); - System.out.println("encoding=" + encoding); - if(encoding == 16){ - int zlen = rfb.readU32(); - System.out.println("zlen=" + zlen); - } - rfb.reset(); + rfb.printFramebufferUpdate(); // rfb.mark(rfb.available()); rfb.mark(1000000); System.out.println("rfb.available()="+rfb.available()); - rfb.printNumBytesRead(); +// rfb.printNumBytesRead(); long bufSize = rfb.getNumBytesRead(); // Read message type from the server. int msgType = rfb.readServerMessageType(); @@ -571,10 +558,8 @@ default: throw new Exception("Unknown RFB message type " + msgType); } - rfb.printNumBytesRead(); bufSize = rfb.getNumBytesRead() - bufSize; System.out.println("bufSize="+bufSize); - rfb.bufResetSend((int)bufSize); if(rfb.available() < bufSize){ System.out.println("rfb.available() < bufSize"); @@ -897,7 +882,8 @@ if (zrleInStream == null) zrleInStream = new ZlibInStream(); - +// System.out.println("zrleInStream.end="+zrleInStream.inflater.off); + int nBytes = rfb.readU32(); if (nBytes > 64 * 1024 * 1024) throw new Exception("ZRLE decoder: illegal compressed data size"); diff -r 4eda2dbb7fef -r ccad9909e0e2 src/ZlibInStream.java --- a/src/ZlibInStream.java Sun Apr 17 23:59:13 2011 +0900 +++ b/src/ZlibInStream.java Tue Apr 19 16:46:27 2011 +0900 @@ -51,6 +51,7 @@ } public int pos() { return ptrOffset + ptr; } + protected int overrun(int itemSize, int nItems) throws Exception { if (itemSize > bufSize)