Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 98:8f4c45c1b396
add serial number to desktop size encoding packet.
author | oc |
---|---|
date | Thu, 22 May 2014 21:10:54 +0900 |
parents | 44f5cdc63a76 |
children | da5f74092be8 |
files | src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java src/main/java/jp/ac/u_ryukyu/treevnc/server/RequestScreenThread.java |
diffstat | 4 files changed, 18 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Thu May 22 19:45:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Thu May 22 21:10:54 2014 +0900 @@ -27,14 +27,16 @@ //final static String versionMsg_3_855 = "RFB 003.855\n"; final static String versionMsg_3_856 = "RFB 003.856\n"; private int clients; - protected MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MulticastQueue<LinkedList<ByteBuffer>>(); + public MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MulticastQueue<LinkedList<ByteBuffer>>(); private RequestScreenThread rThread; private boolean proxyFlag = true; private EchoClient echo; private String proxyAddr; public int acceptPort; protected boolean readyReconnect = false; - private boolean cuiVersion; + private boolean cuiVersion; + private long counter = 0; // packet serial number + public MyRfbProto() { rThread = new RequestScreenThread(this); @@ -298,7 +300,6 @@ } else { // Send dummy data os.write(initData); - } } @@ -420,7 +421,16 @@ int width = context.getFbWidth(); int height = context.getFbHeight(); desktopSize.add(new UpdateRectangleMessage(0,0, width, height, EncodingType.DESKTOP_SIZE).getMessage()); + multicastqueue.put(desktopSize); } + + + public void addSerialNumber(LinkedList<ByteBuffer> bufs) { + ByteBuffer serialNum = multicastqueue.allocate(8); + serialNum.putLong(counter++); + serialNum.flip(); + bufs.addFirst(serialNum); + } }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java Thu May 22 19:45:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java Thu May 22 21:10:54 2014 +0900 @@ -7,7 +7,7 @@ public class UpdateRectangleMessage { - private ByteBuffer msg = ByteBuffer.allocate(16).order(ByteOrder.LITTLE_ENDIAN); + private ByteBuffer msg = ByteBuffer.allocate(16).order(ByteOrder.BIG_ENDIAN); public UpdateRectangleMessage(int i, int j, int width, int height, EncodingType desktopSize) {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java Thu May 22 19:45:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java Thu May 22 21:10:54 2014 +0900 @@ -45,7 +45,6 @@ private ServerSocket servSock; protected int acceptPort; - // private byte initData[]; private LinkedList<Socket> cliListTmp; private LinkedList<Socket> cliList; boolean createBimgFlag; @@ -57,13 +56,13 @@ private Inflater inflater = new Inflater(); private Deflater deflater = new Deflater(); - private RequestScreenThread rThread; + public RequestScreenThread rThread; private Thread requestThread; private int rangeX = 256; // screenRange XPosition private int rangeY = 256; // screenRange YPosition // private int rangeWidth = 512; // screenRange Width private int rangeHeight = 256; // screenRange Height - private int counter = 0; // add serialnum. + public MyRfbProtoProxy() { rThread = new RequestScreenThread(this); @@ -313,13 +312,7 @@ blen.flip(); bufs.addFirst(blen); bufs.addFirst(header); - - - ByteBuffer serialNum = multicastqueue.allocate(8); - serialNum.putLong(counter++); - serialNum.flip(); - bufs.addFirst(serialNum); - + addSerialNumber(bufs); multicastqueue.put(bufs); return;
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/RequestScreenThread.java Thu May 22 19:45:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/RequestScreenThread.java Thu May 22 21:10:54 2014 +0900 @@ -5,7 +5,7 @@ import com.glavsoft.rfb.protocol.Protocol; public class RequestScreenThread implements Runnable { - MyRfbProto rfb; + public MyRfbProto rfb; Protocol protocol; public RequestScreenThread(MyRfbProto _rfb) {