31
|
1 package jp.ac.u_ryukyu.treevnc;
|
11
|
2 import java.net.Socket;
|
|
3 import java.io.InputStream;
|
|
4 import java.io.OutputStream;
|
|
5
|
17
|
6 import com.glavsoft.transport.Reader;
|
|
7 import com.glavsoft.transport.Writer;
|
|
8
|
11
|
9 public class AcceptThread implements Runnable {
|
38
|
10 public MyRfbProto rfb = null;
|
11
|
11 byte[] imageBytes;
|
|
12 int port;
|
|
13
|
31
|
14 public AcceptThread(MyRfbProto _rfb, int p) {
|
11
|
15 rfb = _rfb;
|
|
16 port = p;
|
|
17 }
|
|
18
|
31
|
19 public void changeRfb(MyRfbProto _rfb) {
|
11
|
20 rfb = _rfb;
|
|
21 }
|
|
22
|
|
23 public void run() {
|
|
24 while (true) {
|
|
25 try {
|
|
26 Socket newCli = rfb.accept();
|
|
27 OutputStream os = newCli.getOutputStream();
|
|
28 InputStream is = newCli.getInputStream();
|
17
|
29 rfb.newClient(this, newCli, new Writer(os), new Reader(is));
|
126
|
30 } catch (Exception e) {
|
151
|
31 System.out.println("failed to connect incoming client" + e.getMessage());
|
11
|
32 }
|
|
33 }
|
|
34 }
|
|
35 }
|