Mercurial > hg > Members > nobuyasu > tightVNCClient
comparison src/myVncClient/MyRfbProto.java @ 65:4225c2fd3e16
modify CuiMyVncClient.java
author | e085711 |
---|---|
date | Fri, 05 Aug 2011 19:46:51 +0900 |
parents | 18a19d8a09f4 |
children | 5e7110277cf0 |
comparison
equal
deleted
inserted
replaced
64:d19913a42a36 | 65:4225c2fd3e16 |
---|---|
1 package myVncClient; | 1 package myVncClient; |
2 | 2 |
3 import java.awt.Graphics; | 3 import java.awt.Graphics; |
4 import java.awt.Image; | 4 import java.awt.Image; |
5 import java.awt.image.BufferedImage; | 5 import java.awt.image.BufferedImage; |
6 import java.io.BufferedInputStream; | |
6 import java.io.BufferedOutputStream; | 7 import java.io.BufferedOutputStream; |
7 import java.io.BufferedReader; | 8 import java.io.BufferedReader; |
8 import java.io.ByteArrayInputStream; | 9 import java.io.ByteArrayInputStream; |
9 import java.io.ByteArrayOutputStream; | 10 import java.io.ByteArrayOutputStream; |
11 import java.io.DataInputStream; | |
10 import java.io.IOException; | 12 import java.io.IOException; |
11 import java.io.InputStream; | 13 import java.io.InputStream; |
12 import java.io.InputStreamReader; | 14 import java.io.InputStreamReader; |
13 import java.net.BindException; | 15 import java.net.BindException; |
14 import java.net.ServerSocket; | 16 import java.net.ServerSocket; |
58 | 60 |
59 ExecutorService executor; | 61 ExecutorService executor; |
60 | 62 |
61 byte[] pngBytes; | 63 byte[] pngBytes; |
62 | 64 |
65 | |
63 // private MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MostRecentMultiCast<LinkedList<ByteBuffer>>(10); | 66 // private MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MostRecentMultiCast<LinkedList<ByteBuffer>>(10); |
64 private MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MulticastQueue<LinkedList<ByteBuffer>>(); | 67 private MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MulticastQueue<LinkedList<ByteBuffer>>(); |
65 private int clients = 0; | 68 private int clients = 0; |
66 private Inflater inflater = new Inflater(); | 69 private Inflater inflater = new Inflater(); |
67 | 70 |
82 createBimgFlag = false; | 85 createBimgFlag = false; |
83 // sendThreads = new LinkedList<Thread>(); | 86 // sendThreads = new LinkedList<Thread>(); |
84 // executor = Executors.newCachedThreadPool(); | 87 // executor = Executors.newCachedThreadPool(); |
85 // executor = Executors.newSingleThreadExecutor(); | 88 // executor = Executors.newSingleThreadExecutor(); |
86 } | 89 } |
87 | 90 |
91 | |
88 // over write | 92 // over write |
89 void writeVersionMsg() throws IOException { | 93 void writeVersionMsg() throws IOException { |
90 clientMajor = 3; | 94 clientMajor = 3; |
91 if (serverMinor >= 9) { | 95 if (serverMinor >= 9) { |
92 clientMinor = 9; | 96 clientMinor = 9; |
299 rectX = readU16(); // 4 | 303 rectX = readU16(); // 4 |
300 rectY = readU16(); // 6 | 304 rectY = readU16(); // 6 |
301 rectW = readU16(); // 8 | 305 rectW = readU16(); // 8 |
302 rectH = readU16(); // 10 | 306 rectH = readU16(); // 10 |
303 encoding = readU32(); // 12 | 307 encoding = readU32(); // 12 |
304 System.out.println("encoding = "+encoding); | 308 // System.out.println("encoding = "+encoding); |
305 if (encoding == EncodingZRLE) | 309 if (encoding == EncodingZRLE) |
306 zLen = readU32(); | 310 zLen = readU32(); |
307 else | 311 else |
308 zLen = 0; | 312 zLen = 0; |
309 is.reset(); | 313 is.reset(); |
701 while(inputIndex < outs.size()) { | 705 while(inputIndex < outs.size()) { |
702 ByteBuffer out= outs.get(inputIndex++); | 706 ByteBuffer out= outs.get(inputIndex++); |
703 os.write(out.array(),out.position(),out.limit()); | 707 os.write(out.array(),out.position(),out.limit()); |
704 } | 708 } |
705 } | 709 } |
710 if (encoding==RfbProto.EncodingRaw) { | |
711 LinkedList<ByteBuffer> outs = bufs; | |
712 inputIndex = 0; | |
713 while( inputIndex < outs.size()){ | |
714 ByteBuffer out = outs.get(inputIndex++); | |
715 os.write(out.array(), out.position(), out.limit()); | |
716 } | |
717 } | |
706 os.flush(); | 718 os.flush(); |
707 continue; | 719 continue; |
708 } | 720 } |
709 os.write(header.array(),header.position(),header.limit()); | 721 os.write(header.array(),header.position(),header.limit()); |
710 while(inputIndex < bufs.size()) { | 722 while(inputIndex < bufs.size()) { |