Mercurial > hg > Members > nobuyasu > tightVNCClient
changeset 2:dc1d008d987b
commit test
author | e085711 |
---|---|
date | Wed, 13 Apr 2011 07:37:04 +0900 |
parents | df7ded6bc56e |
children | c930d146670f |
files | src/RfbProto.java src/VncCanvas.java src/VncViewer.java src/ZlibInStream.java |
diffstat | 4 files changed, 18 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/RfbProto.java Tue Apr 12 14:51:30 2011 +0900 +++ b/src/RfbProto.java Wed Apr 13 07:37:04 2011 +0900 @@ -172,8 +172,6 @@ private long numBytesRead = 0; public long getNumBytesRead() { return numBytesRead; } - boolean TEST=false; - Socket cliSock; // Java on UNIX does not call keyPressed() on some keys, for example @@ -231,9 +229,6 @@ if (viewer.socketFactory == null) { sock = new Socket(host, port); - if(TEST){ - cliSock = new Socket("localhost",5550); - } } else { try {
--- a/src/VncCanvas.java Tue Apr 12 14:51:30 2011 +0900 +++ b/src/VncCanvas.java Wed Apr 13 07:37:04 2011 +0900 @@ -27,7 +27,7 @@ import java.io.*; import java.lang.*; import java.util.zip.*; - +import java.net.*; // // VncCanvas is a subclass of Canvas which draws a VNC desktop on it. @@ -375,18 +375,16 @@ // // main dispatch loop // + + long count = 0; while (true) { - - if(rfb.TEST){ - System.out.println("rfb.available()="+rfb.available()); - byte b[] = new byte[rfb.available()]; - rfb.readFully(b); - rfb.cliSock.getOutputStream().write(b, 0, b.length); - } - - + System.out.println("\ncount="+count); + count++; + System.out.println("rfb.available()="+rfb.available()); + while(rfb.available() == 0)continue; + // Read message type from the server. int msgType = rfb.readServerMessageType();
--- a/src/VncViewer.java Tue Apr 12 14:51:30 2011 +0900 +++ b/src/VncViewer.java Wed Apr 13 07:37:04 2011 +0900 @@ -162,21 +162,15 @@ - - /*****************************************************************************/ -// /* vncFrame.pack(); vncFrame.show(); try{ rfb = new RfbProto(host, port, this); - try { - rfb.readVersionMsg(); - rfb.writeVersionMsg(); - int secType = rfb.negotiateSecurity(); - }catch(Exception e){} - ServerSocket serverSocket = new ServerSocket(5550); - Socket socket = serverSocket.accept(); + rfb.readVersionMsg(); + rfb.writeVersionMsg(); + int secType = rfb.negotiateSecurity(); + Socket socket = new Socket("hades.cr.ie.u-ryukyu.ac.jp",5550); rfb.chsock(socket); rfb.framebufferWidth = 1680; @@ -194,8 +188,11 @@ rfb.inNormalProtocol = true; createCanvas(0, 0); - }catch(IOException e) {} - + }catch(IOException e) { + System.out.println("Socket error"); + System.exit(0); + }catch(Exception e ){} + gbc.weightx = 1.0; gbc.weighty = 1.0;
--- a/src/ZlibInStream.java Tue Apr 12 14:51:30 2011 +0900 +++ b/src/ZlibInStream.java Wed Apr 13 07:37:04 2011 +0900 @@ -44,7 +44,7 @@ if (underlying == null) return; while (bytesIn > 0) { - decompress(); + decompress(); end = 0; // throw away any data } underlying = null; @@ -92,7 +92,6 @@ } int n = inflater.inflate(b, end, bufSize - end); - end += n; if (inflater.needsInput()) { bytesIn -= avail_in;