Mercurial > hg > Members > nobuyasu > tightVNCClient
comparison src/myVncClient/MyVncClient.java @ 98:1d1bb77d871b
update
author | one |
---|---|
date | Fri, 21 Oct 2011 17:25:33 +0900 |
parents | 3c4bebe9bf15 |
children | 084adee7699b |
comparison
equal
deleted
inserted
replaced
97:19aff5293769 | 98:1d1bb77d871b |
---|---|
24 boolean first = true; | 24 boolean first = true; |
25 | 25 |
26 EchoClient echoValue; | 26 EchoClient echoValue; |
27 int echoPort; | 27 int echoPort; |
28 String pHost; | 28 String pHost; |
29 TextBox getHost; | |
29 | 30 |
30 // | 31 // |
31 // main() is called when run as a java program from the command line. | 32 // main() is called when run as a java program from the command line. |
32 // It simply runs the applet inside a newly-created frame. | 33 // It simply runs the applet inside a newly-created frame. |
33 // | 34 // |
40 | 41 |
41 private void runClient(String[] argv) { | 42 private void runClient(String[] argv) { |
42 mainArgs = argv; | 43 mainArgs = argv; |
43 inAnApplet = false; | 44 inAnApplet = false; |
44 inSeparateFrame = true; | 45 inSeparateFrame = true; |
46 getHost = new TextBox(); | |
45 | 47 |
46 if (mainArgs.length > 0) | 48 if (mainArgs.length > 0) |
47 pHost = mainArgs[0]; | 49 pHost = mainArgs[0]; |
48 else | 50 else |
49 pHost = "cls080.ie.u-ryukyu.ac.jp"; | 51 getHost.ipRegister(); |
52 pHost = getHost.getAddress(); | |
53 | |
54 | |
55 //pHost = "cls080.ie.u-ryukyu.ac.jp"; | |
50 if (mainArgs.length > 1) | 56 if (mainArgs.length > 1) |
51 port = Integer.parseInt(mainArgs[1]); | 57 port = Integer.parseInt(mainArgs[1]); |
52 else | 58 else |
53 port = 5999; | 59 port = Integer.parseInt(getHost.getPort()); |
60 //port = 5999; | |
54 | 61 |
55 init(); | 62 init(); |
56 start_threads(); | 63 start_threads(); |
57 start(); | 64 start(); |
58 } | 65 } |
151 e2.printStackTrace(); | 158 e2.printStackTrace(); |
152 } | 159 } |
153 System.out.println("Socket error"); | 160 System.out.println("Socket error"); |
154 // parent no find | 161 // parent no find |
155 Random rnd = new Random(); | 162 Random rnd = new Random(); |
156 long ran = rnd.nextInt(5000) + 5000; | 163 long ran = rnd.nextInt(3000) + 3000; |
157 System.out.println(ran); | 164 System.out.println(ran); |
158 // 親がいない場合の処理はここに書く!!!! | 165 // 親がいない場合の処理はここに書く!!!! |
159 /** | 166 /** |
160 * this while reconnection | 167 * this while reconnection |
161 */ | 168 */ |
176 Thread.sleep(ran); | 183 Thread.sleep(ran); |
177 } catch (InterruptedException e1) { | 184 } catch (InterruptedException e1) { |
178 e1.printStackTrace(); | 185 e1.printStackTrace(); |
179 } | 186 } |
180 | 187 |
181 if (counter >= 4) { | 188 if (counter >= 6) { |
182 echoValue.openport(); | 189 echoValue.openport(); |
183 echoValue.notfoundParent(); | 190 echoValue.notfoundParent(); |
184 } | 191 } |
185 | 192 |
186 echoValue.openport(); | 193 echoValue.openport(); |