Mercurial > hg > Members > nobuyasu > tightVNCProxy
changeset 9:c0ad3ecdf827
create method cliSize(). cliSize() is clisList.size()
author | e085711 |
---|---|
date | Sat, 16 Apr 2011 01:19:18 +0900 |
parents | 67caa17deb6f |
children | 2840c7a259f1 |
files | src/VncCanvas.java src/VncViewer.java |
diffstat | 2 files changed, 34 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/src/VncCanvas.java Sat Apr 16 01:08:39 2011 +0900 +++ b/src/VncCanvas.java Sat Apr 16 01:19:18 2011 +0900 @@ -380,45 +380,48 @@ long count = 0; while (true) { - + rfb.accept(); + + if (rfb.MYVNC) { - System.out.println("\ncount=" + count); - - int nBytes = 0; - rfb.mark(20); - int msgType = rfb.readU8(); - System.out.println("msgType=" + msgType); + if (rfb.cliSize() > 0) { + System.out.println("\ncount=" + count); - rfb.skipBytes(11); - int encoding = rfb.readU32(); - System.out.println("encoding=" + encoding); - nBytes = rfb.readU32(); - System.out.println("nBytes=" + nBytes); - rfb.reset(); + int nBytes = 0; + rfb.mark(20); + int msgType = rfb.readU8(); + System.out.println("msgType=" + msgType); - int len = rfb.available(); - System.out.println("rfb.available()=" + len); - if (len > 0) { + rfb.skipBytes(11); + int encoding = rfb.readU32(); + System.out.println("encoding=" + encoding); + nBytes = rfb.readU32(); + System.out.println("nBytes=" + nBytes); + rfb.reset(); - + int len = rfb.available(); + System.out.println("rfb.available()=" + len); + if (len > 0) { - if (nBytes > 0 & encoding == 16) {// 0より大きい(データがある)ときデータを転送 + if (nBytes > 0 & encoding == 16) {// 0より大きい(データがある)ときデータを転送 - rfb.mark(nBytes + 20); + rfb.mark(nBytes + 20); - byte b[] = new byte[nBytes + 20]; - // byte b[] = new byte[18+rfb.rnBytes]; - System.out.println("b.length=" + b.length); + byte b[] = new byte[nBytes + 20]; + // byte b[] = new byte[18+rfb.rnBytes]; + System.out.println("b.length=" + b.length); - rfb.readFully(b); + rfb.readFully(b); -// rfb.cliSock.getOutputStream().write(b, 0, b.length); - rfb.sendData(b); + // rfb.cliSock.getOutputStream().write(b, 0, + // b.length); + rfb.sendData(b); - try { - rfb.reset(); - } catch (IOException e) { - System.out.println(e); + try { + rfb.reset(); + } catch (IOException e) { + System.out.println(e); + } } } } @@ -453,11 +456,6 @@ int rx = rfb.updateRectX, ry = rfb.updateRectY; int rw = rfb.updateRectW, rh = rfb.updateRectH; - if (rfb.MYVNC) { - System.out.println("updateRectEncoding=" - + rfb.updateRectEncoding); - } - if (rfb.updateRectEncoding == rfb.EncodingLastRect) break;