# HG changeset patch # User e085711 # Date 1314549555 -32400 # Node ID f6cb1edc2036b021bbb7dc90dbd121c4a64a4bdd # Parent affdcbdc90ea9f1c491fb7c63ff8536ae56b91b9 modify EchoClient.java. System.exit(0) diff -r affdcbdc90ea -r f6cb1edc2036 src/myVncClient/CuiMyVncClient.java --- a/src/myVncClient/CuiMyVncClient.java Sun Aug 07 13:40:56 2011 +0900 +++ b/src/myVncClient/CuiMyVncClient.java Mon Aug 29 01:39:15 2011 +0900 @@ -192,7 +192,7 @@ echo.openport(); // runflag = echo.losthost(); if (echo.losthost()) { - return; + break; } counter++; } @@ -984,5 +984,10 @@ public void start() { } + public void close() { + rfb.close(); + vncFrame.setVisible(false); + vncFrame.dispose(); + } } diff -r affdcbdc90ea -r f6cb1edc2036 src/myVncClient/EchoClient.java --- a/src/myVncClient/EchoClient.java Sun Aug 07 13:40:56 2011 +0900 +++ b/src/myVncClient/EchoClient.java Mon Aug 29 01:39:15 2011 +0900 @@ -74,6 +74,7 @@ } catch (IOException e) { System.out.println("接続に失敗しました"); System.err.println("Couldn't get I/O for the connection to: localhost"); + System.exit(0); } } diff -r affdcbdc90ea -r f6cb1edc2036 src/myVncClient/InterfaceForViewer.java --- a/src/myVncClient/InterfaceForViewer.java Sun Aug 07 13:40:56 2011 +0900 +++ b/src/myVncClient/InterfaceForViewer.java Mon Aug 29 01:39:15 2011 +0900 @@ -24,5 +24,6 @@ public void setClientSocket(Socket sock); + public void close(); } diff -r affdcbdc90ea -r f6cb1edc2036 src/myVncClient/MyRfbProto.java --- a/src/myVncClient/MyRfbProto.java Sun Aug 07 13:40:56 2011 +0900 +++ b/src/myVncClient/MyRfbProto.java Mon Aug 29 01:39:15 2011 +0900 @@ -324,7 +324,7 @@ rectW = readU16(); // 8 rectH = readU16(); // 10 encoding = readU32(); // 12 - // System.out.println("encoding = "+encoding); + System.out.println("encoding = "+encoding); if (encoding == EncodingZRLE|| encoding==EncodingZRLEE||encoding==EncodingZlib) zLen = readU32(); else diff -r affdcbdc90ea -r f6cb1edc2036 src/myVncClient/MyVncClient.java --- a/src/myVncClient/MyVncClient.java Sun Aug 07 13:40:56 2011 +0900 +++ b/src/myVncClient/MyVncClient.java Mon Aug 29 01:39:15 2011 +0900 @@ -10,7 +10,7 @@ WindowListener { /** - * e + * */ private static final long serialVersionUID = 1L; boolean inAnApplet = true; @@ -107,8 +107,8 @@ try { - connectAndAuthenticate(); if (first) { + connectAndAuthenticate(); accThread = new Thread(new AcceptThread(rfb, 5999)); accThread.start(); first = false; @@ -225,7 +225,6 @@ 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(); @@ -388,8 +387,16 @@ } void reConnectAndAuthenticate() throws Exception { + showConnectionStatus("Initializing..."); + if (inSeparateFrame) { + vncFrame.pack(); + vncFrame.setVisible(true); + } else { + validate(); + } + showConnectionStatus("Connecting to " + host + ", port " + port + "..."); rfb.changeParent(host, port); @@ -1145,6 +1152,11 @@ public void setClientSocket(Socket sock) { clientSocket = sock; } + public void close() { + rfb.close(); + vncFrame.setVisible(false); + vncFrame.dispose(); + } } diff -r affdcbdc90ea -r f6cb1edc2036 src/myVncClient/VncCanvas.java --- a/src/myVncClient/VncCanvas.java Sun Aug 07 13:40:56 2011 +0900 +++ b/src/myVncClient/VncCanvas.java Mon Aug 29 01:39:15 2011 +0900 @@ -395,7 +395,7 @@ * read Data from parents and send Data to Client. * */ - rfb.sendDataToClient(); +// rfb.sendDataToClient(); int bufSize = (int)rfb.getNumBytesRead(); @@ -496,6 +496,9 @@ rfb.stopTiming(); + long kbitsPerSecond = rfb.kbitsPerSecond(); +// System.out.println("kbitsPerSecond = " + kbitsPerSecond); + statNumPixelRects++; statNumBytesDecoded += rw * rh * bytesPixel; statNumBytesEncoded += (int) (rfb.getNumBytesRead() - numBytesReadBefore); diff -r affdcbdc90ea -r f6cb1edc2036 src/myVncClient/WaitReply.java --- a/src/myVncClient/WaitReply.java Sun Aug 07 13:40:56 2011 +0900 +++ b/src/myVncClient/WaitReply.java Mon Aug 29 01:39:15 2011 +0900 @@ -38,6 +38,8 @@ try { clientSocket = echoServer.accept(); if(clientSocket != null){ + client.close(); + // client.clientSocket = clientSocket; client.setClientSocket(clientSocket); client.init(null);