diff src/treeVnc/MyVncClient.java @ 3:3b341997141a

broadcast socket trying
author one
date Mon, 23 Apr 2012 20:18:23 +0900
parents 5d72f4c7371d
children
line wrap: on
line diff
--- a/src/treeVnc/MyVncClient.java	Sat Apr 07 14:55:34 2012 +0900
+++ b/src/treeVnc/MyVncClient.java	Mon Apr 23 20:18:23 2012 +0900
@@ -54,7 +54,7 @@
 				if(argv.length==3){
 					pHost = argv[1];
 					port = Integer.parseInt(argv[2]);
-				} else {
+				} else { 
 					getHost = new TextBoxClient();
 					getHost.ipRegister();
 					pHost = getHost.getAddressOption();
@@ -78,7 +78,6 @@
 				port = Integer.parseInt(getBcast.text.getPort());
 				if (!("-reg".equals(argv[0])))
 					getBcast.socketClose();
-
 			}
 		} else {
 			bCast = new BroadCastClient("who");
@@ -89,7 +88,14 @@
 			runBcast.start();
 			getBcast.setStopFlag(true);
 			pHost = getBcast.text.getAddress();
-			port = Integer.parseInt(getBcast.text.getPort());
+			if("notFound".equals(pHost)) {
+				getHost = new TextBoxClient();
+				getHost.ipRegister();
+				pHost = getHost.getAddressOption();
+				port = Integer.parseInt(getHost.getPortOption());
+			} else {
+				port = Integer.parseInt(getBcast.text.getPort());
+			}
 		}
 
 		// getBcast.text.checkBox(getNamePort());