changeset 137:41f049cebcb5

remove unnecessary EchoClient finally
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 08 Jun 2014 19:30:18 +0900
parents 81b558b38b9f
children c3761c896607
files src/main/java/jp/ac/u_ryukyu/treevnc/TReeVNCCommand.java src/main/java/jp/ac/u_ryukyu/treevnc/server/CreateThread.java src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java
diffstat 3 files changed, 1 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TReeVNCCommand.java	Sun Jun 08 19:23:50 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TReeVNCCommand.java	Sun Jun 08 19:30:18 2014 +0900
@@ -119,11 +119,7 @@
      * @param hostname
      */
     private void handleLostParent(int port, String hostname) {
-        try {
-            viewer.fixLostParent(hostname,port);
-        } catch (IOException e) {
-            // log
-        }
+        viewer.fixLostParent(hostname,port);
     }
 
     /**
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/CreateThread.java	Sun Jun 08 19:23:50 2014 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-package jp.ac.u_ryukyu.treevnc.server;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.net.BindException;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class CreateThread implements Runnable {
-	ServerSocket echoServer;
-	AcceptClient acceptClient;
-	private int port;
-	private boolean stopFlag;
-	
-	public CreateThread(AcceptClient _acc) {
-		acceptClient = _acc;
-		port = 9999;
-	}
-	
-
-	void newEchoClient(final BufferedReader is,final PrintStream os) {
-		Runnable echoSender = new Runnable() {
-			public void run() {
-				acceptClient.transferParentAddrerss(is,os);
-			}
-		};
-		new Thread(echoSender).start();
-	}
-
-	void selectPort(int p) {
-		int port = p;
-		while (true) {
-			try {
-				initServSock(port);
-				break;
-			} catch (BindException e) {
-				port++;
-				continue;
-			} catch (IOException e) {
-
-			}
-		}
-		System.out.println("accept Echo port = " + port);
-	}
-	
-	void initServSock(int port) throws IOException {
-		echoServer = new ServerSocket(port);
-		this.port = port;
-	}
-	
-	public int getPort() {
-		return port;
-	}
-	
-	
-	public void run() {
-		selectPort(port);
-		
-		while (true) {
-			try {
-//				echoServer = new ServerSocket(9999);
-				Socket clientSocket = echoServer.accept();
-				if(stopFlag) break;
-				BufferedReader is = new BufferedReader(new InputStreamReader(
-						clientSocket.getInputStream()));
-				PrintStream os = new PrintStream(clientSocket.getOutputStream());
-				newEchoClient(is,os);
-//				acceptClient.transferParentAddrerss(is, os);
-			} catch (IOException e) {
-				System.out.println(e);
-			}
-		}
-
-	}
-	public void setStopFlag(boolean flag){
-		stopFlag = flag;
-	}
-
-}
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java	Sun Jun 08 19:23:50 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java	Sun Jun 08 19:30:18 2014 +0900
@@ -83,13 +83,6 @@
 		isApplet = true;
 		run();
 		createConnectionAndStart();
-		try {
-			threadSetAndStart();
-		} catch (UnknownHostException e) {
-
-		} catch (IOException e) {
-
-		}
 	}
 	
 	/**
@@ -155,12 +148,6 @@
 		closeApp();
 	}
 
-	private void threadSetAndStart() throws UnknownHostException, IOException {
-		CreateThread createThread = new CreateThread(clients);
-		Thread thread = new Thread(createThread);
-		thread.start();
-	}
-
 	protected void socketClose() {
 	}