Mercurial > hg > Applications > TreeVNC
comparison src/main/java/jp/ac/u_ryukyu/treevnc/SendCheckDelay.java @ 239:d655db005535
create sendCheckDelay Socket.
author | oc |
---|---|
date | Sat, 11 Oct 2014 23:46:22 +0900 |
parents | |
children | 7310e7d7a45f |
comparison
equal
deleted
inserted
replaced
238:e21ef8f60f7a | 239:d655db005535 |
---|---|
1 package jp.ac.u_ryukyu.treevnc; | |
2 | |
3 import java.io.UnsupportedEncodingException; | |
4 import java.nio.ByteBuffer; | |
5 import java.util.LinkedList; | |
6 | |
7 import com.glavsoft.rfb.encoding.EncodingType; | |
8 | |
9 | |
10 public class SendCheckDelay implements Runnable { | |
11 | |
12 private TreeRFBProto rfb; | |
13 | |
14 public SendCheckDelay(TreeRFBProto rfb) { | |
15 this.rfb = rfb; | |
16 } | |
17 | |
18 public void sendCheckDelay() throws UnsupportedEncodingException { | |
19 | |
20 LinkedList<ByteBuffer> checkdelay = new LinkedList<ByteBuffer>(); | |
21 long time = System.currentTimeMillis(); | |
22 checkdelay.add(new CheckDelay(0, 0, 0, 0, time, EncodingType.CHECK_DELAY).getMessage()); | |
23 rfb.addSerialNumber(checkdelay); | |
24 rfb.multicastqueue.put(checkdelay); | |
25 | |
26 } | |
27 | |
28 public void run() { | |
29 for (;;) { | |
30 System.out.println("run sendCheckDelay"); | |
31 long timeout = 50000 / 8; | |
32 try { | |
33 synchronized (this) { | |
34 wait(timeout); | |
35 sendCheckDelay(); | |
36 } | |
37 } catch (InterruptedException e) { | |
38 e.printStackTrace(); | |
39 } catch (UnsupportedEncodingException e) { | |
40 e.printStackTrace(); | |
41 } | |
42 } | |
43 } | |
44 | |
45 } |