changeset 174:eea9a1726edf

merge
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Mon, 24 Oct 2011 20:16:23 +0900
parents 607f31debca1 (current diff) 54ad8e0654b5 (diff)
children ec3842bc0aeb
files src/myVncProxy/AcceptClient.java src/myVncProxy/VncProxyService.java
diffstat 1 files changed, 32 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/myVncProxy/VncProxyService.java	Mon Oct 24 20:15:24 2011 +0900
+++ b/src/myVncProxy/VncProxyService.java	Mon Oct 24 20:16:23 2011 +0900
@@ -9,7 +9,7 @@
 	public static void main(String[] argv) {
 		VncProxyService v = new VncProxyService();
 
-		v.checkArgs(argv);
+		//v.checkArgs(argv);
 		
 		v.mainArgs = argv;
 
@@ -29,6 +29,7 @@
 	Thread clientThread;
     CreateThread geth;
     AcceptClient acc;
+    private TextBox getHost; 
 
 	Frame vncFrame;
 	Container vncContainer;
@@ -268,7 +269,11 @@
 	//
 
 	void connectAndAuthenticate() throws Exception {
-	    acc = new AcceptClient(host);
+		if(mainArgs.length==0)
+		    acc = new AcceptClient(getHost.getAddress());
+		//acc = new AcceptClient();
+		else
+		    acc = new AcceptClient(mainArgs[0]);
 	    geth = new CreateThread(acc , echoPort);
 	    Thread thread = new Thread(geth);
 	    thread.start();
@@ -352,7 +357,11 @@
 		vncContainer.remove(authPanel);
 		 */
 		showConnectionStatus("ask password...");
-		String pw = mainArgs[2];
+		String pw;
+		if(mainArgs.length!=0)
+			pw = mainArgs[2];
+		else
+			pw = getHost.getPassword();
 		return pw;
 	}
 
@@ -614,6 +623,21 @@
 	//
 
 	void readParameters() {
+		if(mainArgs.length==0){
+			getHost = new TextBox();
+			getHost.ipRegister();
+			host = getHost.getAddress();
+		} else {
+			host = mainArgs[0];
+		}
+		
+		if(mainArgs.length < 2){
+			port = Integer.parseInt(getHost.getPort());
+//			port = 5900;
+		}else{
+			port = Integer.parseInt(mainArgs[1]);
+		}
+		
 
 		// Read "ENCPASSWORD" or "PASSWORD" parameter if specified.
 //		readPasswordParameters();
@@ -659,8 +683,12 @@
 	//
 
 	private void readPasswordParameters() {
+		String encPasswordParam;
 		// String encPasswordParam = readParameter("ENCPASSWORD", false);
-		String encPasswordParam = mainArgs[2];
+		if(mainArgs.length!=0)
+			encPasswordParam = mainArgs[2];
+		else
+			encPasswordParam = getHost.getPassword();
 
 		if (encPasswordParam == null) {
 			// passwordParam = readParameter("PASSWORD", false);