private static boolean req_join(ObjectInputStream in, ObjectOutputStream out, String name, ScoreTableModel scoretable ) throws Exception {
		if (in == null || out == null) {
			throw new Exception("Given stream is null.");
		} else if (name == null) {
			throw new Exception("Invalid name.");
		}
		
		// Requesting to join
		Packet req1 = new Packet(Packet.Type.JOIN, 0, -1); // Client ID not yet received, so set to -1
		req1.message = name;
		out.writeObject(req1); // Send the join request
		Packet rep1 = (Packet) in.readObject(); // Read the reply. Should contain client_id
		
		if (rep1.cid == 0 && rep1.pid == req1.pid && rep1.type == Packet.Type.JOIN && rep1.value > 0) { // Case: request granted
			main_client.setID(rep1.value);
			
			// Request for a maze update. 
			Packet req2 = new Packet(Packet.Type.MAZE_REQ, 1, main_client.getID());
			out.writeObject(req2); // Send the maze request
			assert(maze == null);
			maze = new MazeImpl(in, mazeSeed, scoretable);
			if (maze != null) {
				return true; //TODO final check
			} else {
				System.err.println("Failed to get the maze update.");
				return false;
			}
			
		} else {
			System.err.println("Failed to join the game.");
			return false;
		}
	}