comparison src/myVncClient/MyRfbProto.java @ 93:71bfbb5241bf

modify CuiMyVncClient
author e085711
date Thu, 22 Sep 2011 05:43:48 +0900
parents d89e03d99b7f
children 53236c2c1229
comparison
equal deleted inserted replaced
92:405ead268439 93:71bfbb5241bf
90 // executor = Executors.newCachedThreadPool(); 90 // executor = Executors.newCachedThreadPool();
91 // executor = Executors.newSingleThreadExecutor(); 91 // executor = Executors.newSingleThreadExecutor();
92 } 92 }
93 93
94 MyRfbProto(String h, int p, MyVncClient v) throws IOException { 94 MyRfbProto(String h, int p, MyVncClient v) throws IOException {
95 super(h, p, v); 95 super(h, p);
96 this.viewer = v; 96 this.viewer = v;
97 cliList = new LinkedList<Socket>(); 97 cliList = new LinkedList<Socket>();
98 cliListTmp = new LinkedList<Socket>(); 98 cliListTmp = new LinkedList<Socket>();
99 createBimgFlag = false; 99 createBimgFlag = false;
100 proxyFlag = false; 100 proxyFlag = false;
101 // sendThreads = new LinkedList<Thread>(); 101 // sendThreads = new LinkedList<Thread>();
102 // executor = Executors.newCachedThreadPool(); 102 // executor = Executors.newCachedThreadPool();
103 // executor = Executors.newSingleThreadExecutor(); 103 // executor = Executors.newSingleThreadExecutor();
104 } 104 }
105
106 MyRfbProto(String h, int p, CuiMyVncClient v) throws IOException {
107 super(h, p);
108 this.viewer = v;
109 cliList = new LinkedList<Socket>();
110 cliListTmp = new LinkedList<Socket>();
111 createBimgFlag = false;
112 proxyFlag = false;
113 // sendThreads = new LinkedList<Thread>();
114 // executor = Executors.newCachedThreadPool();
115 // executor = Executors.newSingleThreadExecutor();
116 }
117
118
105 MyRfbProto(String h, int p) throws IOException { 119 MyRfbProto(String h, int p) throws IOException {
106 super(h, p); 120 super(h, p);
107 cliList = new LinkedList<Socket>(); 121 cliList = new LinkedList<Socket>();
108 cliListTmp = new LinkedList<Socket>(); 122 cliListTmp = new LinkedList<Socket>();
109 createBimgFlag = false; 123 createBimgFlag = false;
527 BufferedImage bimg = getBufferedImage(viewer.getScreenImage()); 541 BufferedImage bimg = getBufferedImage(viewer.getScreenImage());
528 try { 542 try {
529 byte[] b = getImageBytes(bimg, imageFormat); 543 byte[] b = getImageBytes(bimg, imageFormat);
530 // int len = b.length; 544 // int len = b.length;
531 byte[] length = castIntByte(b.length); 545 byte[] length = castIntByte(b.length);
532 System.out.println("jpeg length = " + b.length); 546 // System.out.println("jpeg length = " + b.length);
533
534 byte c = 0x05;
535 os.write((byte)WriteJpegData); 547 os.write((byte)WriteJpegData);
536 os.write(length); // length of jpeg data 548 os.write(length); // length of jpeg data
537 os.write(b); // jpeg data 549 os.write(b); // jpeg data
538 os.flush(); 550 os.flush();
539 } catch (IOException e) { 551 } catch (IOException e) {
540 e.printStackTrace(); 552 e.printStackTrace();
541 } 553 }
542 } 554 }
543 555
556 // unnecessary method
544 void readWriteJpegData() throws IOException { 557 void readWriteJpegData() throws IOException {
545 byte[] b = readJpegData(); 558 byte[] b = readJpegData();
546 viewer.writeScreenData(b, "jpeg"); 559 viewer.writeScreenData(b, "jpeg");
547 } 560 }
548 561