comparison src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java @ 14:ff01665d26b4

Remove TextBoxProxy
author one
date Thu, 23 Aug 2012 20:22:32 +0900
parents 12c3a73be47f
children 5d43194fdc51
comparison
equal deleted inserted replaced
13:406fa09ae645 14:ff01665d26b4
92 void initServSock(int port) throws IOException { 92 void initServSock(int port) throws IOException {
93 servSock = new ServerSocket(port); 93 servSock = new ServerSocket(port);
94 acceptPort = port; 94 acceptPort = port;
95 } 95 }
96 96
97 void authenticationRequestAccess() throws IOException {
98
99 byte[] headBuf = new byte[2];
100 is.read(headBuf);
101 if (headBuf[1] == 2) {
102 byte[] b = new byte[258];
103 is.read(b);
104
105 byte[] outBuf = new byte[256];
106 os.write(outBuf);
107 os.flush();
108 } else if (headBuf[1] == 23) {
109 byte[] b = new byte[130];
110 is.read(b);
111 byte[] outBuf = new byte[192];
112 os.write(outBuf);
113 os.flush();
114 }
115
116 int result = readU32();
117 if (result != 0) {
118 System.out.println("faild authentication ");
119 throw new IOException();
120 }
121
122 }
123
124 /* 97 /*
125 * default port number is 5999. 98 * default port number is 5999.
126 */ 99 */
127 public void selectPort(int p) { 100 public void selectPort(int p) {
128 if (servSock != null) 101 if (servSock != null)
159 } 132 }
160 133
161 void addSockTmp(Socket sock) { 134 void addSockTmp(Socket sock) {
162 System.out.println("connected " + sock.getInetAddress()); 135 System.out.println("connected " + sock.getInetAddress());
163 cliListTmp.add(sock); 136 cliListTmp.add(sock);
164 }
165
166 boolean markSupported() {
167 return is.markSupported();
168 } 137 }
169 138
170 synchronized void changeStatusFlag() { 139 synchronized void changeStatusFlag() {
171 printStatusFlag = true; 140 printStatusFlag = true;
172 } 141 }
319 ByteBuffer len = ByteBuffer.allocate(4); 288 ByteBuffer len = ByteBuffer.allocate(4);
320 readFully(len.array(), 0, 4); 289 readFully(len.array(), 0, 4);
321 len.limit(4); 290 len.limit(4);
322 ByteBuffer inputData = ByteBuffer.allocate(dataLen - 20); 291 ByteBuffer inputData = ByteBuffer.allocate(dataLen - 20);
323 292
324 startTiming();
325 readFully(inputData.array(), 0, inputData.capacity()); 293 readFully(inputData.array(), 0, inputData.capacity());
326 // System.out.println(dataLen); 294 // System.out.println(dataLen);
327 inputData.limit(dataLen - 20); 295 inputData.limit(dataLen - 20);
328 stopTiming();
329 296
330 LinkedList<ByteBuffer> inputs = new LinkedList<ByteBuffer>(); 297 LinkedList<ByteBuffer> inputs = new LinkedList<ByteBuffer>();
331 inputs.add(inputData); 298 inputs.add(inputData);
332 299
333 header.putInt(12, RfbProto.EncodingZRLEE); // means recompress 300 header.putInt(12, RfbProto.EncodingZRLEE); // means recompress
359 return; 326 return;
360 } 327 }
361 bufs.add(header); 328 bufs.add(header);
362 if (dataLen > 16) { 329 if (dataLen > 16) {
363 ByteBuffer b = ByteBuffer.allocate(dataLen - 16); 330 ByteBuffer b = ByteBuffer.allocate(dataLen - 16);
364 startTiming();
365 readFully(b.array(), 0, dataLen - 16); 331 readFully(b.array(), 0, dataLen - 16);
366 b.limit(dataLen - 16); 332 b.limit(dataLen - 16);
367 stopTiming();
368 bufs.add(b); 333 bufs.add(b);
369 } 334 }
370 multicastqueue.put(bufs); 335 multicastqueue.put(bufs);
371 // is.reset(); 336 // is.reset();
372 return; 337 return;