@Override
	public void run()
	{
		if(listenSocket == null)
		{
			if(!setupTCPListener())
			{
				System.err.println("TCP listen socket not started.");
				return;
			}
		}
		
		running = true;			//set running flag
		try
		{
	        while(running)
	        {
	            Socket clientSocket = listenSocket.accept();
				TCPConnection connection = new TCPConnection(clientSocket);
				this.observer.setChanged();
	            this.observer.notifyObservers(connection);
	        }
		}
		catch(SocketException e)
		{
			System.out.println("TCP socket: " + e.getMessage());
		}
		catch(IOException e)
		{
			System.err.println("IO: " + e.getMessage());
		}
	}