comparison src/treeVnc/AcceptThread.java @ 0:756bfaf731f3

create new repository
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Tue, 21 Feb 2012 04:10:12 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:756bfaf731f3
1 package treeVnc;
2 import java.net.Socket;
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.io.OutputStream;
6
7 public class AcceptThread implements Runnable {
8 MyRfbProto rfb = null;
9 byte[] imageBytes;
10 int port;
11
12 AcceptThread(MyRfbProto _rfb) {
13 rfb = _rfb;
14 }
15
16
17 AcceptThread(MyRfbProto _rfb, int p) {
18 rfb = _rfb;
19 port = p;
20 }
21
22 public void changeRfb(MyRfbProto _rfb) {
23 rfb = _rfb;
24 }
25
26 public void run() {
27 rfb.selectPort(port);
28
29 while (true) {
30 try {
31 Socket newCli = rfb.accept();
32
33 OutputStream os = newCli.getOutputStream();
34 InputStream is = newCli.getInputStream();
35 rfb.newClient(this, newCli, os, is);
36 } catch (IOException e) {
37 e.printStackTrace();
38 System.out.println(e);
39 }
40 }
41 }
42 }