comparison src/main/java/jp/ac/u_ryukyu/treevnc/AcceptThread.java @ 88:a719aa609e14

add name valuer threads.
author oc
date Thu, 01 May 2014 19:12:05 +0900
parents 986f16afb753
children 775ce6a14f89
comparison
equal deleted inserted replaced
87:9a485070f831 88:a719aa609e14
9 9
10 public class AcceptThread implements Runnable { 10 public class AcceptThread implements Runnable {
11 public MyRfbProto rfb = null; 11 public MyRfbProto rfb = null;
12 byte[] imageBytes; 12 byte[] imageBytes;
13 int port; 13 int port;
14 public boolean flag = false;
15 14
16 public AcceptThread(MyRfbProto _rfb) { 15 public AcceptThread(MyRfbProto _rfb) {
17 rfb = _rfb; 16 rfb = _rfb;
18 } 17 }
19 18
31 rfb.selectPort(port); 30 rfb.selectPort(port);
32 31
33 while (true) { 32 while (true) {
34 try { 33 try {
35 Socket newCli = rfb.accept(); 34 Socket newCli = rfb.accept();
36 if(flag) throw new IOException();
37 OutputStream os = newCli.getOutputStream(); 35 OutputStream os = newCli.getOutputStream();
38 InputStream is = newCli.getInputStream(); 36 InputStream is = newCli.getInputStream();
39 // if(confirmHalt(is)) break;
40 rfb.newClient(this, newCli, new Writer(os), new Reader(is)); 37 rfb.newClient(this, newCli, new Writer(os), new Reader(is));
41 } catch (IOException e) { 38 } catch (IOException e) {
42 break; 39 break;
43 } 40 }
44 } 41 }
45 } 42 }
46
47
48
49
50 /**
51 * Instruction stop if you come from if WaitReply.
52 * @return if return true. This Thread halt.
53 */
54 /*
55 private boolean confirmHalt(InputStream is) throws IOException {
56 byte[] b = new byte[4];
57 is.mark(4);
58 is.read(b);
59 if(String.valueOf(b).equals("halt")) return true;
60 is.reset();
61 return false;
62 }
63 */
64 } 43 }