Mercurial > hg > Members > nobuyasu > tightVNCProxy
diff src/myVncProxy/MyRfbProto.java @ 130:cb00150c223e
implement sendEchoPort
author | e085711 |
---|---|
date | Tue, 30 Aug 2011 05:39:12 +0900 |
parents | 2ff8d5a226c9 |
children | 2a90459a05f0 |
line wrap: on
line diff
--- a/src/myVncProxy/MyRfbProto.java Mon Aug 08 16:54:34 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Tue Aug 30 05:39:12 2011 +0900 @@ -70,7 +70,8 @@ private int clients = 0; private Inflater inflater = new Inflater(); private Deflater deflater = new Deflater(); - + private CreateThread geth; + public MyRfbProto() throws IOException { } @@ -79,6 +80,11 @@ super(h, p, v); } + MyRfbProto(String h, int p, CreateThread geth) throws IOException { + super(h, p); + this.geth = geth; + } + MyRfbProto(String h, int p) throws IOException { super(h, p); } @@ -226,6 +232,16 @@ "RFB server does not support protocol version 3"); } + if (serverMinor == 998) { + sendPortNumber(); + } + + } + + void sendPortNumber() throws IOException { + byte[] b = new byte[4]; + b = castIntByte(geth.port); + os.write(b); } void sendSecurityType(OutputStream os) throws IOException { @@ -313,24 +329,24 @@ switch (encoding) { case RfbProto.EncodingRaw: dataLen = rectW * rectH * 4 + 16; - is.mark(dataLen); +// is.mark(dataLen); break; case RfbProto.EncodingCopyRect: dataLen = 16 + 4; - is.mark(dataLen); +// is.mark(dataLen); break; case RfbProto.EncodingRRE: case RfbProto.EncodingCoRRE: case RfbProto.EncodingHextile: case RfbProto.EncodingTight: dataLen = zLen + 20; - is.mark(dataLen); +// is.mark(dataLen); break; case RfbProto.EncodingZlib: case RfbProto.EncodingZRLE: case RfbProto.EncodingZRLEE: dataLen = zLen + 20; - is.mark(dataLen); +// is.mark(dataLen); break; case RfbProto.EncodingXCursor: case RfbProto.EncodingRichCursor: @@ -338,11 +354,11 @@ int u8Array = (int)Math.floor((rectW + 7)/8) * rectH; dataLen = pixArray + u8Array; printFramebufferUpdate(); - is.mark(dataLen); +// is.mark(dataLen); break; default: dataLen = 1000000; - is.mark(dataLen); +// is.mark(dataLen); } return dataLen; } @@ -350,6 +366,7 @@ void sendDataToClient() throws Exception { regiFramebufferUpdate(); + printFramebufferUpdate(); int dataLen = checkAndMark(); readSendData(dataLen); } @@ -419,6 +436,10 @@ default: } } + int returnMsgtype() { + return messageType; + } + void readSpeedCheck() throws IOException { byte[] b = new byte[1]; @@ -603,10 +624,10 @@ bufs.addFirst(header); multicastqueue.put(bufs); - is.reset(); + +// is.reset(); return ; } - } bufs.add(header); if (dataLen>16) { ByteBuffer b = ByteBuffer.allocate(dataLen-16); @@ -615,6 +636,8 @@ } multicastqueue.put(bufs); is.reset(); + } + is.reset(); // It may be compressed. We can inflate here to avoid repeating clients decompressing here, // but it may generate too many large data. It is better to do it in each client.