comparison src/myVncClient/MyVncClient.java @ 107:40efe6c25ff6

create BroadCast.java and GetBroadCast.java
author one
date Tue, 22 Nov 2011 13:38:21 +0900
parents 3599045a7312
children
comparison
equal deleted inserted replaced
106:df9986f30d09 107:40efe6c25ff6
25 boolean first = true; 25 boolean first = true;
26 26
27 private EchoClient echoValue; 27 private EchoClient echoValue;
28 private int echoPort; 28 private int echoPort;
29 private String pHost; 29 private String pHost;
30 private TextBox getHost; 30 //private TextBox getHost;
31 private GetBroadCast getBcast; 31 private GetBroadCast getBcast;
32 private Thread runBcast; 32 private Thread runBcast;
33 private BroadCast bCast;
33 34
34 // 35 //
35 // main() is called when run as a java program from the command line. 36 // main() is called when run as a java program from the command line.
36 // It simply runs the applet inside a newly-created frame. 37 // It simply runs the applet inside a newly-created frame.
37 // 38 //
44 45
45 private void runClient(String[] argv) { 46 private void runClient(String[] argv) {
46 mainArgs = argv; 47 mainArgs = argv;
47 inAnApplet = false; 48 inAnApplet = false;
48 inSeparateFrame = true; 49 inSeparateFrame = true;
49 getBcast = new GetBroadCast(); 50 if(mainArgs.length == 0) {
50 runBcast = new Thread(getBcast); 51 bCast = new BroadCast("who");
51 runBcast.start(); 52 bCast.createSocket();
53 bCast.sendData();
54 getBcast = new GetBroadCast();
55 runBcast = new Thread(getBcast);
56 runBcast.start();
57 }
52 58
53 try { 59 try {
54 Thread.sleep(5000); 60 Thread.sleep(1000);
55 } catch (InterruptedException e) { 61 } catch (InterruptedException e) {
56 e.printStackTrace(); 62 e.printStackTrace();
57 } 63 }
58 getBcast.setStopFlag(true); 64 if(mainArgs.length == 0)
65 getBcast.setStopFlag(true);
59 66
60 if (mainArgs.length > 0) 67 if (mainArgs.length > 0)
61 pHost = mainArgs[0]; 68 pHost = mainArgs[0];
62 else { 69 else {
63 pHost = getBcast.text.getAddress(); 70 pHost = getBcast.text.getAddress();