public void run() {
		try {
			out = new DataOutputStream(socket.getOutputStream());
			in = new DataInputStream(socket.getInputStream());
			while (loop(in, out))
				;
		} catch (EOFException e) {
			log("EOFException...lost connection.");
			Server.threads.remove(this);
			return;
		} catch (IOException e) {
			log("IOException...did we lose the connection?");
			e.printStackTrace();
			return;
		} finally {
			try {
				ArrayList<ChatPlayer> playersLost = PlayerManager.getPlayersByServer(name);
				String msg = "";
				for (ChatPlayer p : playersLost) {
					msg += p.name + " ";
					PlayerManager.players.remove(p);
				}
				log("Players lost: " + msg);
				Server.broadcast(new ServerLeftPacket(name));

				if (out != null)
					out.close();
				if (in != null)
					in.close();
				socket.close();

				Server.threads.remove(this);
			} catch (IOException e) {
				log("Error closing socket");
			}
		}
	}