public void run() {
		
		long lastread = System.currentTimeMillis();
		
		try {
			
			boolean isread;
			
			//while (true){
			while (!clientSocket.isClosed()){
								
				isread = false;
				
				while (in.available() > 0) {
					
					String command = in.readUTF();

					System.out.println("Received from TCP client: " + command);
					cmdDisp.execCommand(command);
					
					isread = true;
					lastread = System.currentTimeMillis();
					
					//out.writeUTF("write from server");
					
				}
				
				Thread.sleep(8);
				
				if ((System.currentTimeMillis() - lastread > clienttimeout) && !isread) {
					System.out.println("client went away");
					clientSocket.close();
					return;
				}								
				
			}
			System.out.println("client closed");
			
		} catch (EOFException e) {
			System.out.println("EOF: " + e.getMessage());
		} catch (IOException e) {
			System.out.println("IO: " + e.getMessage());
		} catch (InterruptedException e) {
			System.out.println("IE: " + e.getMessage());
		}
	}