# HG changeset patch # User e085711 # Date 1318369504 -32400 # Node ID 13458f88d8c9203a4dc5f7b11c918fd03393f35c # Parent 1fdee3cb0908b45ec5d5ce13ef8c6458e1faa6e1 add RequestScreenThread.java diff -r 1fdee3cb0908 -r 13458f88d8c9 src/myVncProxy/MyRfbProto.java --- a/src/myVncProxy/MyRfbProto.java Wed Oct 12 02:52:13 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Wed Oct 12 06:45:04 2011 +0900 @@ -71,6 +71,9 @@ private Inflater inflater = new Inflater(); private Deflater deflater = new Deflater(); private CreateThread geth; +// private Thread requestThread; + private RequestScreenThread rThread; + private Thread requestThread; public MyRfbProto() throws IOException { @@ -78,18 +81,30 @@ MyRfbProto(String h, int p, VncViewer v) throws IOException { super(h, p, v); + + rThread = new RequestScreenThread(this); + requestThread = new Thread(rThread); +// requestThread = new Thread(new RequestScreenThread(this)); } MyRfbProto(String h, int p, CreateThread geth) throws IOException { super(h, p); this.geth = geth; proxyFlag = true; + + rThread = new RequestScreenThread(this); + requestThread = new Thread(rThread); +// requestThread = new Thread(new RequestScreenThread(this)); } MyRfbProto(String h, int p) throws IOException { super(h, p); + + rThread = new RequestScreenThread(this); + requestThread = new Thread(rThread); +// requestThread = new Thread(new RequestScreenThread(this)); } - + // over write void writeVersionMsg() throws IOException { clientMajor = 3; @@ -514,6 +529,15 @@ new Thread(stdin).start(); } + + void requestThreadStart() { + requestThread.start(); + } + + public synchronized void requestThreadNotify() { + rThread.reStart(); + } + /** * gzip byte arrays @@ -762,7 +786,8 @@ readClientInit(is); sendInitData(os); new Thread(reader).start(); // discard incoming packet here after. - writeFramebufferUpdateRequest(0,0, framebufferWidth, framebufferHeight, false ); +// writeFramebufferUpdateRequest(0,0, framebufferWidth, framebufferHeight, false ); + requestThreadNotify(); for (;;) { LinkedList bufs = c.poll(); int inputIndex = 0; diff -r 1fdee3cb0908 -r 13458f88d8c9 src/myVncProxy/RequestScreenThread.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/myVncProxy/RequestScreenThread.java Wed Oct 12 06:45:04 2011 +0900 @@ -0,0 +1,38 @@ +package myVncProxy; + +public class RequestScreenThread implements Runnable { + MyRfbProto rfb; + + RequestScreenThread(MyRfbProto _rfb) { + rfb = _rfb; + } + + public void run() { + while (true) { + try { + waitThread(); + Thread.sleep(3000); + rfb.writeFramebufferUpdateRequest(0, 0, rfb.framebufferWidth, + rfb.framebufferHeight, false); + + } catch (Exception e) { + e.printStackTrace(); + break; + } + } + } + + public synchronized void waitThread() { + try{ + wait(); + }catch(InterruptedException e) { + e.printStackTrace(); + } + } + + public synchronized void reStart() { + notify(); + } + + +} diff -r 1fdee3cb0908 -r 13458f88d8c9 src/myVncProxy/VncProxyService.java --- a/src/myVncProxy/VncProxyService.java Wed Oct 12 02:52:13 2011 +0900 +++ b/src/myVncProxy/VncProxyService.java Wed Oct 12 06:45:04 2011 +0900 @@ -144,7 +144,7 @@ rfb.selectPort(5999); rfbThread = new Thread(this); accThread = new Thread(new AcceptThread(rfb, 5999)); - + /* if(url != null) { try { @@ -181,6 +181,8 @@ public void start_threads(){ rfbThread.start(); accThread.start(); + rfb.requestThreadStart(); + } //