annotate src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java @ 67:2908e4b95b0a

add file
author Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
date Sat, 01 Feb 2014 07:48:16 +0900
parents
children cdf7bbe45885
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package jp.ac.u_ryukyu.treevnc;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 import java.util.Map;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 import com.glavsoft.viewer.Viewer;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 import com.glavsoft.viewer.ViewerImpl;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 import com.glavsoft.viewer.mvp.View;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 import com.glavsoft.viewer.swing.ConnectionParams;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 import jp.ac.u_ryukyu.treevnc.client.EchoClient;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 import jp.ac.u_ryukyu.treevnc.client.GetDataClient;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 import jp.ac.u_ryukyu.treevnc.client.GetHostClient;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 public class CreateConnectionParam {
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 private String hostName;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 private int portNumber;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 private MyRfbProto rfb;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 public CreateConnectionParam(MyRfbProto rfb) {
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 this.rfb = rfb;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 }
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 public void communicationToProxy() {
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 GetHostClient bCast = new GetHostClient("who");
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 bCast.getHost();
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 GetDataClient getBcast = new GetDataClient();
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 Thread runBcast = new Thread(getBcast);
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 runBcast.start();
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 hostName = getBcast.textAddress();
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 portNumber = Integer.parseInt(getBcast.textPort());
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 getBcast.interrupt();
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 }
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 public void createConnectionParam(ViewerImpl v) {
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 EchoClient echo = new EchoClient(hostName, 9999);
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 rfb.setEcho(echo);
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 rfb.setProxyAddr(hostName);
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 echo.getParentName();
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 v.setConnectionParam(echo.getParentsAddress(), portNumber);
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 runAcceptThread();
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 }
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 private void runAcceptThread() {
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 Thread accThread = new Thread(new AcceptThread(rfb, portNumber));
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 accThread.start();
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 }
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 public void setHostName(String _hostName) {
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 hostName = _hostName;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 portNumber = 5999;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 }
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 }