Mercurial > hg > Members > nobuyasu > tightVNCClient
comparison src/myVncClient/MyRfbProto.java @ 89:3ea33e683522
modify RFB Protocol Version. From 3.998 to 3.855
author | e085711 |
---|---|
date | Tue, 20 Sep 2011 05:56:11 +0900 |
parents | 29e43be288ca |
children | 7a1e934144e6 |
comparison
equal
deleted
inserted
replaced
87:6c43d40abfe6 | 89:3ea33e683522 |
---|---|
33 import java.util.zip.Inflater; | 33 import java.util.zip.Inflater; |
34 import java.io.OutputStream; | 34 import java.io.OutputStream; |
35 | 35 |
36 public | 36 public |
37 class MyRfbProto extends RfbProto { | 37 class MyRfbProto extends RfbProto { |
38 final static String versionMsg_3_998 = "RFB 003.998\n"; | 38 final static String versionMsg_3_855 = "RFB 003.855\n"; |
39 | |
39 /** | 40 /** |
40 * CheckMillis is one of new msgType for RFB 3.998. | 41 * CheckMillis is one of new msgType for RFB 3.855. |
41 */ | 42 */ |
42 final static byte SpeedCheckMillis = 4; | 43 final static byte SpeedCheckMillis = 4; |
43 private static final int INFLATE_BUFSIZE = 1024*100; | 44 private static final int INFLATE_BUFSIZE = 1024*100; |
44 boolean printStatusFlag = false; | 45 boolean printStatusFlag = false; |
45 long startCheckTime; | 46 long startCheckTime; |
84 createBimgFlag = false; | 85 createBimgFlag = false; |
85 // sendThreads = new LinkedList<Thread>(); | 86 // sendThreads = new LinkedList<Thread>(); |
86 // executor = Executors.newCachedThreadPool(); | 87 // executor = Executors.newCachedThreadPool(); |
87 // executor = Executors.newSingleThreadExecutor(); | 88 // executor = Executors.newSingleThreadExecutor(); |
88 } | 89 } |
89 | 90 |
90 MyRfbProto(String h, int p) throws IOException { | 91 MyRfbProto(String h, int p) throws IOException { |
91 super(h, p); | 92 super(h, p); |
92 cliList = new LinkedList<Socket>(); | 93 cliList = new LinkedList<Socket>(); |
93 cliListTmp = new LinkedList<Socket>(); | 94 cliListTmp = new LinkedList<Socket>(); |
94 createBimgFlag = false; | 95 createBimgFlag = false; |
96 // executor = Executors.newCachedThreadPool(); | 97 // executor = Executors.newCachedThreadPool(); |
97 // executor = Executors.newSingleThreadExecutor(); | 98 // executor = Executors.newSingleThreadExecutor(); |
98 } | 99 } |
99 | 100 |
100 | 101 |
102 | |
101 void readVersionMsg() throws Exception { | 103 void readVersionMsg() throws Exception { |
102 | 104 |
103 byte[] b = new byte[12]; | 105 byte[] b = new byte[12]; |
104 | 106 |
105 readFully(b); | 107 readFully(b); |
119 if (serverMajor < 3) { | 121 if (serverMajor < 3) { |
120 throw new Exception( | 122 throw new Exception( |
121 "RFB server does not support protocol version 3"); | 123 "RFB server does not support protocol version 3"); |
122 } | 124 } |
123 | 125 |
124 if (serverMinor == 998) { | 126 if (serverMinor == 855) { |
125 | 127 |
126 } | 128 } |
127 | 129 |
128 } | 130 } |
129 byte[] readEchoPort() throws Exception { | 131 byte[] readEchoPort() throws Exception { |
150 } | 152 } |
151 | 153 |
152 // over write | 154 // over write |
153 void writeVersionMsg() throws IOException { | 155 void writeVersionMsg() throws IOException { |
154 clientMajor = 3; | 156 clientMajor = 3; |
155 if (serverMinor >= 9) { | 157 if (serverMinor == 855) { |
156 clientMinor = 9; | 158 clientMinor = 855; |
157 os.write(versionMsg_3_998.getBytes()); | 159 os.write(versionMsg_3_855.getBytes()); |
158 } else if (serverMajor > 3 || serverMinor >= 8) { | 160 } else if (serverMajor > 3 || serverMinor >= 8) { |
159 clientMinor = 8; | 161 clientMinor = 8; |
160 os.write(versionMsg_3_8.getBytes()); | 162 os.write(versionMsg_3_8.getBytes()); |
161 } else if (serverMinor >= 9) { | |
162 clientMinor = 9; | |
163 os.write(versionMsg_3_998.getBytes()); | |
164 } else if (serverMinor >= 7) { | 163 } else if (serverMinor >= 7) { |
165 clientMinor = 7; | 164 clientMinor = 7; |
166 os.write(versionMsg_3_7.getBytes()); | 165 os.write(versionMsg_3_7.getBytes()); |
167 } else { | 166 } else { |
168 clientMinor = 3; | 167 clientMinor = 3; |
264 | 263 |
265 inNormalProtocol = true; | 264 inNormalProtocol = true; |
266 } | 265 } |
267 | 266 |
268 void sendRfbVersion(OutputStream os) throws IOException { | 267 void sendRfbVersion(OutputStream os) throws IOException { |
269 // os.write(versionMsg_3_998.getBytes()); | 268 // os.write(versionMsg_3_855.getBytes()); |
270 os.write(versionMsg_3_8.getBytes()); | 269 os.write(versionMsg_3_8.getBytes()); |
271 } | 270 } |
272 | 271 |
273 void readVersionMsg(InputStream is) throws IOException { | 272 void readVersionMsg(InputStream is) throws IOException { |
274 | 273 |