changeset 107:40efe6c25ff6

create BroadCast.java and GetBroadCast.java
author one
date Tue, 22 Nov 2011 13:38:21 +0900
parents df9986f30d09
children e66137b514eb
files src/myVncClient/MyVncClient.java
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/myVncClient/MyVncClient.java	Tue Nov 15 19:54:48 2011 +0900
+++ b/src/myVncClient/MyVncClient.java	Tue Nov 22 13:38:21 2011 +0900
@@ -27,9 +27,10 @@
 	private EchoClient echoValue;		
 	private int echoPort;
 	private String pHost;
-	private TextBox getHost;
+	//private TextBox getHost;
 	private GetBroadCast getBcast;
 	private Thread runBcast;
+	private BroadCast bCast;
 
 	//
 	// main() is called when run as a java program from the command line.
@@ -46,16 +47,22 @@
 		mainArgs = argv;
 		inAnApplet = false;
 		inSeparateFrame = true;
-		getBcast = new GetBroadCast();
-		runBcast = new Thread(getBcast);
-		runBcast.start();
+		if(mainArgs.length == 0) {
+			bCast = new BroadCast("who");
+			bCast.createSocket();
+			bCast.sendData();
+			getBcast = new GetBroadCast();
+			runBcast = new Thread(getBcast);
+			runBcast.start();
+		}
 		
 		try {
-			Thread.sleep(5000);
+			Thread.sleep(1000);
 		} catch (InterruptedException e) {
 			e.printStackTrace();
 		}
-		getBcast.setStopFlag(true);
+		if(mainArgs.length == 0)
+			getBcast.setStopFlag(true);
 
 		if (mainArgs.length > 0)
 			pHost = mainArgs[0];