# HG changeset patch # User e085711 # Date 1312692056 -32400 # Node ID affdcbdc90ea9f1c491fb7c63ff8536ae56b91b9 # Parent 1f05b73b15df8a70ce2542bd34818993acedafe2 modify CreateCanva.java. implement ZRLEE. diff -r 1f05b73b15df -r affdcbdc90ea src/myVncClient/CuiMyVncClient.java --- a/src/myVncClient/CuiMyVncClient.java Sun Aug 07 04:22:07 2011 +0900 +++ b/src/myVncClient/CuiMyVncClient.java Sun Aug 07 13:40:56 2011 +0900 @@ -96,12 +96,13 @@ // public void init(EchoClient value) { + Random rnd = new Random(); long ran = rnd.nextInt(5000); try { Thread.sleep(ran); - } catch (InterruptedException e1) { - e1.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); } // readParameters(); @@ -142,18 +143,19 @@ try { if (first) { connectAndAuthenticate(); + accThread = new Thread(new AcceptThread(rfb, 5999)); + accThread.start(); first = false; }else { reConnectAndAuthenticate(); } - accThread = new Thread(new AcceptThread(rfb, 5999)); - accThread.start(); doProtocolInitialisation(); vc = new CuiVncCanvas(this, 0, 0); vc.updateFramebufferSize(); } catch (IOException e) { + System.out.println("Socket error"); // parent no find Random rnd = new Random(); @@ -194,7 +196,6 @@ } counter++; } - // System.exit(0); }catch (Exception e) { System.out.println(e); @@ -328,8 +329,8 @@ } } - - + + void reConnectAndAuthenticate() throws Exception { showConnectionStatus("Initializing..."); diff -r 1f05b73b15df -r affdcbdc90ea src/myVncClient/MyVncClient.java --- a/src/myVncClient/MyVncClient.java Sun Aug 07 04:22:07 2011 +0900 +++ b/src/myVncClient/MyVncClient.java Sun Aug 07 13:40:56 2011 +0900 @@ -107,14 +107,15 @@ try { + connectAndAuthenticate(); if (first) { - connectAndAuthenticate(); + accThread = new Thread(new AcceptThread(rfb, 5999)); + accThread.start(); first = false; }else { + System.out.println("reConnectAndAuthenticate() "); reConnectAndAuthenticate(); } - accThread = new Thread(new AcceptThread(rfb, 5999)); - accThread.start(); doProtocolInitialisation(); @@ -124,6 +125,12 @@ // vc.drawFirstImage(); } catch (IOException e) { + try{ + rfb.sock.close(); + + }catch(IOException e2){ + e2.printStackTrace(); + } System.out.println("Socket error"); // parent no find Random rnd = new Random(); @@ -218,7 +225,8 @@ fatalError("Network error: could not connect to server: " + host + ":" + port, e); } catch (EOFException e) { - + System.out.println("EOFException : rfb.sock.close()"); + vncFrame.setVisible(false); vncFrame.dispose(); // num4 diff -r 1f05b73b15df -r affdcbdc90ea src/myVncClient/VncCanvas.java --- a/src/myVncClient/VncCanvas.java Sun Aug 07 04:22:07 2011 +0900 +++ b/src/myVncClient/VncCanvas.java Sun Aug 07 13:40:56 2011 +0900 @@ -478,6 +478,10 @@ statNumRectsZRLE++; handleZRLERect(rx, ry, rw, rh); break; + case RfbProto.EncodingZRLEE: + statNumRectsZRLE++; + handleZRLERect(rx, ry, rw, rh); + break; case RfbProto.EncodingZlib: handleZlibRect(rx, ry, rw, rh); break; @@ -876,7 +880,8 @@ // void handleZRLERect(int x, int y, int w, int h) throws Exception { - + if (rfb.updateRectEncoding==RfbProto.EncodingZRLEE) zrleInStream = null; + if (zrleInStream == null) zrleInStream = new ZlibInStream();