Mercurial > hg > Applications > TightVNC_orginal
changeset 8:a096a009bbda
add AcceptThread.java
author | Taninari YU <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 13 Aug 2012 09:09:36 +0900 |
parents | 30bd62abf424 |
children | 1a30763734cf |
files | src/main/java/ac/ryukyu/treevnc/client/AcceptThread.java |
diffstat | 1 files changed, 42 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/ac/ryukyu/treevnc/client/AcceptThread.java Mon Aug 13 09:09:36 2012 +0900 @@ -0,0 +1,42 @@ +package ac.ryukyu.treevnc.client; +import java.net.Socket; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class AcceptThread implements Runnable { + MyRfbProtoClient rfb = null; + byte[] imageBytes; + int port; + + AcceptThread(MyRfbProtoClient _rfb) { + rfb = _rfb; + } + + + AcceptThread(MyRfbProtoClient _rfb, int p) { + rfb = _rfb; + port = p; + } + + public void changeRfb(MyRfbProtoClient _rfb) { + rfb = _rfb; + } + + public void run() { + rfb.selectPort(port); + + while (true) { + try { + Socket newCli = rfb.accept(); + + OutputStream os = newCli.getOutputStream(); + InputStream is = newCli.getInputStream(); + rfb.newClient(this, newCli, os, is); + } catch (IOException e) { + e.printStackTrace(); + System.out.println(e); + } + } + } +}