comparison src/myVncClient/MyVncClient.java @ 105:3599045a7312

add broadcast
author one
date Tue, 15 Nov 2011 19:53:47 +0900
parents 2f2f8da71d60
children 40efe6c25ff6
comparison
equal deleted inserted replaced
104:5241bf573f69 105:3599045a7312
22 String parent, treenum; 22 String parent, treenum;
23 private String leaderflag; 23 private String leaderflag;
24 boolean runflag = false; 24 boolean runflag = false;
25 boolean first = true; 25 boolean first = true;
26 26
27 EchoClient echoValue; 27 private EchoClient echoValue;
28 int echoPort; 28 private int echoPort;
29 String pHost; 29 private String pHost;
30 TextBox getHost; 30 private TextBox getHost;
31 private GetBroadCast getBcast;
32 private Thread runBcast;
31 33
32 // 34 //
33 // main() is called when run as a java program from the command line. 35 // main() is called when run as a java program from the command line.
34 // It simply runs the applet inside a newly-created frame. 36 // It simply runs the applet inside a newly-created frame.
35 // 37 //
42 44
43 private void runClient(String[] argv) { 45 private void runClient(String[] argv) {
44 mainArgs = argv; 46 mainArgs = argv;
45 inAnApplet = false; 47 inAnApplet = false;
46 inSeparateFrame = true; 48 inSeparateFrame = true;
47 getHost = new TextBox(); 49 getBcast = new GetBroadCast();
50 runBcast = new Thread(getBcast);
51 runBcast.start();
52
53 try {
54 Thread.sleep(5000);
55 } catch (InterruptedException e) {
56 e.printStackTrace();
57 }
58 getBcast.setStopFlag(true);
48 59
49 if (mainArgs.length > 0) 60 if (mainArgs.length > 0)
50 pHost = mainArgs[0]; 61 pHost = mainArgs[0];
51 else { 62 else {
52 getHost.ipRegister(); 63 pHost = getBcast.text.getAddress();
53 pHost = getHost.getAddress();
54 } 64 }
55 65
56 66
57 //pHost = "cls080.ie.u-ryukyu.ac.jp"; 67 //pHost = "cls080.ie.u-ryukyu.ac.jp";
58 if (mainArgs.length > 1) 68 if (mainArgs.length > 1)
59 port = Integer.parseInt(mainArgs[1]); 69 port = Integer.parseInt(mainArgs[1]);
60 else 70 else
61 71 port = Integer.parseInt(getBcast.text.getPort());
62 port = 5999; 72 // port = 5999;
63 73
64 init(); 74 init();
65 start_threads(); 75 start_threads();
66 start(); 76 start();
67 } 77 }