Mercurial > hg > Applications > TreeVNC
diff src/main/java/ac/ryukyu/treevnc/server/AcceptThread.java @ 11:57ae9fbb1245
add files
author | Taninari YU <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 21 Aug 2012 14:02:05 +0900 (2012-08-21) |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/ac/ryukyu/treevnc/server/AcceptThread.java Tue Aug 21 14:02:05 2012 +0900 @@ -0,0 +1,42 @@ +package ac.ryukyu.treevnc.server; +import java.net.Socket; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class AcceptThread implements Runnable { + MyRfbProto rfb = null; + byte[] imageBytes; + int port; + + AcceptThread(MyRfbProto _rfb) { + rfb = _rfb; + } + + + AcceptThread(MyRfbProto _rfb, int p) { + rfb = _rfb; + port = p; + } + + public void changeRfb(MyRfbProto _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); + } + } + } +}