Mercurial > hg > Members > nobuyasu > tightVNCProxy
diff src/myVncProxy/MyRfbProto.java @ 43:08317224ce21
create RFB 003.998
author | e085711 |
---|---|
date | Thu, 23 Jun 2011 07:03:21 +0900 |
parents | dd1321b67f95 |
children | ff1d1f236c8a |
line wrap: on
line diff
--- a/src/myVncProxy/MyRfbProto.java Thu Jun 23 04:47:53 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Thu Jun 23 07:03:21 2011 +0900 @@ -7,6 +7,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.net.BindException; import java.net.ServerSocket; @@ -21,6 +22,9 @@ class MyRfbProto extends RfbProto { + final static String versionMsg_3_998 = "RFB 003.998\n"; + + private int messageType; private int rectangles; private int rectX; @@ -64,6 +68,31 @@ executor = Executors.newSingleThreadExecutor(); } + // override + void writeVersionMsg() throws IOException { + clientMajor = 3; + if (serverMinor >= 9) { + clientMinor = 9; + os.write(versionMsg_3_998.getBytes()); + } else if (serverMajor > 3 || serverMinor >= 8) { + clientMinor = 8; + os.write(versionMsg_3_8.getBytes()); + } else if (serverMinor >= 9) { + clientMinor = 9; + os.write(versionMsg_3_998.getBytes()); + } else if (serverMinor >= 7) { + clientMinor = 7; + os.write(versionMsg_3_7.getBytes()); + } else { + clientMinor = 3; + os.write(versionMsg_3_3.getBytes()); + } + protocolTightVNC = false; + initCapabilities(); + } + + + void initServSock(int port) throws IOException{ servSock = new ServerSocket(port); acceptPort = port; @@ -160,8 +189,23 @@ inNormalProtocol = true; } - void sendInitData(Socket sock) throws IOException{ - sock.getOutputStream().write(initData); + void sendRfbVersion(OutputStream os) throws IOException{ + os.write(versionMsg_3_998.getBytes()); + } + void sendSecurityType(OutputStream os) throws IOException { + // number-of-security-types + os.write(1); + // security-types + // 1:None + os.write(1); + } + void readClientInit(InputStream in) throws IOException { + byte[] b = new byte[0]; + in.read(b); + } + + void sendInitData(OutputStream os) throws IOException{ + os.write(initData); } void sendData(byte b[]){ @@ -326,3 +370,5 @@ } } } + +