Mercurial > hg > Members > nobuyasu > tightVNCProxy
changeset 155:0510022e9e92
modify MyRfbProto
author | e085711 |
---|---|
date | Thu, 22 Sep 2011 05:20:51 +0900 |
parents | 6606b71b64a6 |
children | b570efb0d266 |
files | src/myVncProxy/MyRfbProto.java |
diffstat | 1 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/myVncProxy/MyRfbProto.java Tue Sep 20 05:56:24 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Thu Sep 22 05:20:51 2011 +0900 @@ -59,6 +59,7 @@ private LinkedList<Socket> cliListTmp; private LinkedList<Socket> cliList; boolean createBimgFlag; + boolean proxyFlag = true; ExecutorService executor; @@ -82,6 +83,7 @@ MyRfbProto(String h, int p, CreateThread geth) throws IOException { super(h, p); this.geth = geth; + proxyFlag = true; } MyRfbProto(String h, int p) throws IOException { @@ -209,7 +211,7 @@ os.write(versionMsg_3_855.getBytes()); } - void readVersionMsg(InputStream is, OutputStream os) throws IOException { + int readVersionMsg(InputStream is, OutputStream os) throws IOException { byte[] b = new byte[12]; @@ -224,18 +226,31 @@ + " is not an RFB server"); } - serverMajor = (b[4] - '0') * 100 + (b[5] - '0') * 10 + (b[6] - '0'); - serverMinor = (b[8] - '0') * 100 + (b[9] - '0') * 10 + (b[10] - '0'); + int rfbMajor = (b[4] - '0') * 100 + (b[5] - '0') * 10 + (b[6] - '0'); + int rfbMinor = (b[8] - '0') * 100 + (b[9] - '0') * 10 + (b[10] - '0'); - if (serverMajor < 3) { + if (rfbMajor < 3) { throw new IOException( "RFB server does not support protocol version 3"); } - if (serverMinor == 855) { - sendPortNumber(os); + if (rfbMinor == 855) { + sendProxyFlag(os); + if(proxyFlag)sendPortNumber(os); } - + return rfbMinor; + } + void sendProxyFlag(OutputStream os) throws IOException { + if(proxyFlag) os.write(1); + else os.write(0); + } + + boolean readProxyFlag() throws IOException{ + int flag = readU8(); + if(flag == 1) + return true; + else + return false; } void sendPortNumber(OutputStream os) throws IOException { @@ -728,7 +743,7 @@ */ sendRfbVersion(os); // readVersionMsg(is); - readVersionMsg(is,os); + int rfbMinor = readVersionMsg(is,os); sendSecurityType(os); readSecType(is); sendSecResult(os);