public void run() {
		byte[] command = new byte[4];
		ok = 0;
		while (ok != -1) {
			try {
				ok = is.read(command);
				int com = Conversions.ByteArrayToInt(command);
				switch (com) {
				case Constants.ADDGAME:
					addCommand(connection, is);
					break;
				case Constants.GAMELISTING:
					sendGames(os);
					break;
				case Constants.SENDMESSAGE:
					fetchMessage();
					break;
				case Constants.SENDGAMENAME:
					break;
				case Constants.LEAVEGAME:
					deRegisterGame(connection, is);
					break;
				case Constants.STARTGAME:
				break;
				default:
					connection.close();
					ok = -1;
					break;
				}
			} catch (IOException ie) {
				ok = -1;
			}
		}
		gm.notifyWaiters();
		return;
	}