private void listen() throws IOException, InterruptedException {
		reply(200);

		String line = null;
		while ((line = reader.readLine()) != null) {
			StringTokenizer st = new StringTokenizer(line);
			String command = st.nextToken().toLowerCase();

			int code = 0;
			if (command.equals("register-peer")) {
				code = register(st);
			} else if (command.equals("upload")) {
				code = upload(st);
			} else if (command.equals("query")) {
				code = query(st);
			} else if (command.equals("download")) {
				code = download(st);
			} else if (command.equals("port")) {
				code = setPort(st);
			} else if (command.equals("quit")) {
				code = quit();
			}

			if (code == 221 || code == 0) return;
		}
	}