Mercurial > hg > Members > nobuyasu > tightVNCClient
changeset 8:efb8090ce9c3
update MyRfbProto
author | e085711 |
---|---|
date | Sat, 16 Apr 2011 00:15:26 +0900 (2011-04-15) |
parents | 94c9e7825be2 |
children | 2237c4a06427 |
files | src/MyRfbProto.java |
diffstat | 1 files changed, 37 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/MyRfbProto.java Fri Apr 15 23:50:43 2011 +0900 +++ b/src/MyRfbProto.java Sat Apr 16 00:15:26 2011 +0900 @@ -1,7 +1,12 @@ import java.io.IOException; import java.net.Socket; +import java.nio.ByteBuffer; + class MyRfbProto extends RfbProto { + + private byte initData[]; + MyRfbProto(String h, int p, VncViewer v) throws IOException { super(h, p, v); } @@ -14,11 +19,19 @@ is.reset(); } - final boolean markSupported() { + boolean markSupported() { return is.markSupported(); } - - void init(Socket sock) throws IOException { + + void readServerInit() throws IOException { + + mark(255); + skipBytes(20); + int nlen = readU32(); + initData = new byte[20+4+nlen]; + readFully(initData); + reset(); + framebufferWidth = readU16(); framebufferHeight = readU16(); bitsPerPixel = readU8(); @@ -31,10 +44,30 @@ redShift = readU8(); greenShift = readU8(); blueShift = readU8(); + byte[] pad = new byte[3]; + readFully(pad); + int nameLength = readU32(); + byte[] name = new byte[nameLength]; + readFully(name); + desktopName = new String(name); + // Read interaction capabilities (TightVNC protocol extensions) + if (protocolTightVNC) { + int nServerMessageTypes = readU16(); + int nClientMessageTypes = readU16(); + int nEncodingTypes = readU16(); + readU16(); + readCapabilityList(serverMsgCaps, nServerMessageTypes); + readCapabilityList(clientMsgCaps, nClientMessageTypes); + readCapabilityList(encodingCaps, nEncodingTypes); + } + + inNormalProtocol = true; } + void sendinitData(Socket sock) throws IOException{ + sock.getOutputStream().write(initData); + } - }