comparison src/myVncProxy/VncProxyService.java @ 145:8bdbed4c4505

add template.txt
author e085711
date Mon, 05 Sep 2011 06:03:14 +0900
parents c1d7d4fbcfb9
children a2b5149bbbe6
comparison
equal deleted inserted replaced
144:c1d7d4fbcfb9 145:8bdbed4c4505
129 cursorUpdatesDef = null; 129 cursorUpdatesDef = null;
130 eightBitColorsDef = null; 130 eightBitColorsDef = null;
131 131
132 try{ 132 try{
133 connectAndAuthenticate(); 133 connectAndAuthenticate();
134 doProtocolInitialisation();
134 }catch (NoRouteToHostException e) { 135 }catch (NoRouteToHostException e) {
135 fatalError("Network error: no route to server: " + host, e); 136 fatalError("Network error: no route to server: " + host, e);
136 } catch (UnknownHostException e) { 137 } catch (UnknownHostException e) {
137 fatalError("Network error: server name unknown: " + host, e); 138 fatalError("Network error: server name unknown: " + host, e);
138 } catch (ConnectException e) { 139 } catch (ConnectException e) {
147 if(url != null) { 148 if(url != null) {
148 try { 149 try {
149 client = new XmlRpc(blogId, wpUsername, wpPassword, url ); 150 client = new XmlRpc(blogId, wpUsername, wpPassword, url );
150 InetAddress addr = InetAddress.getLocalHost(); 151 InetAddress addr = InetAddress.getLocalHost();
151 String add = new String(addr.getHostAddress()); 152 String add = new String(addr.getHostAddress());
153 client.addDescription(rfb.desktopName);
152 setStatusXmlRpc(client, title, add, rfb.acceptPort); 154 setStatusXmlRpc(client, title, add, rfb.acceptPort);
153 client.editPost(); 155 client.editPost();
154 System.out.println("URL:\n" + client.getUrl() + "\n"); 156 System.out.println("URL:\n" + client.getUrl() + "\n");
155 } catch (MalformedURLException e) { 157 } catch (MalformedURLException e) {
156 System.out.println("Faild create instance of class XmlRpc"); 158 System.out.println("Faild create instance of class XmlRpc");
164 } 166 }
165 167
166 void setStatusXmlRpc(XmlRpc client, String title, String hostname, int port) { 168 void setStatusXmlRpc(XmlRpc client, String title, String hostname, int port) {
167 client.setTitle(title); 169 client.setTitle(title);
168 String description = makeDescription(hostname, Integer.toString(port)); 170 String description = makeDescription(hostname, Integer.toString(port));
169 client.setDescription(description); 171 client.addDescription(description);
170 } 172 }
171 173
172 String makeDescription(String hostname, String port) { 174 String makeDescription(String hostname, String port) {
173 String description = "<h1>" + hostname + " " + port + "<h1>\n"; 175 String description = "<h1>" + hostname + " " + port + "<h1>\n";
174 return description; 176 return description;
185 187
186 public void run() { 188 public void run() {
187 189
188 try { 190 try {
189 // connectAndAuthenticate(); 191 // connectAndAuthenticate();
190 doProtocolInitialisation(); 192 // doProtocolInitialisation();
191 /* 193 /*
192 htmlFile = new CreateHtmlFile(rfb, host, username); 194 htmlFile = new CreateHtmlFile(rfb, host, username);
193 htmlFile.createHtml(); 195 htmlFile.createHtml();
194 */ 196 */
195 vc = new ProxyVncCanvas(this, 0, 0); 197 vc = new ProxyVncCanvas(this, 0, 0);
384 return; 386 return;
385 387
386 int preferredEncoding = options.preferredEncoding; 388 int preferredEncoding = options.preferredEncoding;
387 if (preferredEncoding == -1) { 389 if (preferredEncoding == -1) {
388 long kbitsPerSecond = rfb.kbitsPerSecond(); 390 long kbitsPerSecond = rfb.kbitsPerSecond();
391 /*
389 if (nEncodingsSaved < 1) { 392 if (nEncodingsSaved < 1) {
390 // Choose Tight or ZRLE encoding for the very first update. 393 // Choose Tight or ZRLE encoding for the very first update.
391 System.out.println("Using Tight/ZRLE encodings"); 394 System.out.println("Using Tight/ZRLE encodings");
392 preferredEncoding = RfbProto.EncodingTight; 395 preferredEncoding = RfbProto.EncodingTight;
393 } else if (kbitsPerSecond > 2000 396 } else if (kbitsPerSecond > 2000
406 // Don't change the encoder. 409 // Don't change the encoder.
407 if (autoSelectOnly) 410 if (autoSelectOnly)
408 return; 411 return;
409 preferredEncoding = encodingsSaved[0]; 412 preferredEncoding = encodingsSaved[0];
410 } 413 }
414 */
411 } else { 415 } else {
412 // Auto encoder selection is not enabled. 416 // Auto encoder selection is not enabled.
413 if (autoSelectOnly) 417 if (autoSelectOnly)
414 return; 418 return;
415 } 419 }
421 encodings[nEncodings++] = preferredEncoding; 425 encodings[nEncodings++] = preferredEncoding;
422 426
423 if (options.useCopyRect) { 427 if (options.useCopyRect) {
424 encodings[nEncodings++] = RfbProto.EncodingCopyRect; 428 encodings[nEncodings++] = RfbProto.EncodingCopyRect;
425 } 429 }
430 /*
426 if (preferredEncoding != RfbProto.EncodingTight) { 431 if (preferredEncoding != RfbProto.EncodingTight) {
427 encodings[nEncodings++] = RfbProto.EncodingTight; 432 encodings[nEncodings++] = RfbProto.EncodingTight;
428 } 433 }
429 434 */
430 if (preferredEncoding != RfbProto.EncodingZRLE) { 435 if (preferredEncoding != RfbProto.EncodingZRLE) {
431 encodings[nEncodings++] = RfbProto.EncodingZRLE; 436 encodings[nEncodings++] = RfbProto.EncodingZRLE;
432 } 437 }
438 /*
433 if (preferredEncoding != RfbProto.EncodingHextile) { 439 if (preferredEncoding != RfbProto.EncodingHextile) {
434 encodings[nEncodings++] = RfbProto.EncodingHextile; 440 encodings[nEncodings++] = RfbProto.EncodingHextile;
435 } 441 }
436 if (preferredEncoding != RfbProto.EncodingZlib) { 442 if (preferredEncoding != RfbProto.EncodingZlib) {
437 encodings[nEncodings++] = RfbProto.EncodingZlib; 443 encodings[nEncodings++] = RfbProto.EncodingZlib;
438 } 444 }
445 */
439 if (preferredEncoding != RfbProto.EncodingCoRRE) { 446 if (preferredEncoding != RfbProto.EncodingCoRRE) {
440 encodings[nEncodings++] = RfbProto.EncodingCoRRE; 447 encodings[nEncodings++] = RfbProto.EncodingCoRRE;
441 } 448 }
442 if (preferredEncoding != RfbProto.EncodingRRE) { 449 if (preferredEncoding != RfbProto.EncodingRRE) {
443 encodings[nEncodings++] = RfbProto.EncodingRRE; 450 encodings[nEncodings++] = RfbProto.EncodingRRE;