private void ViewFiles(ByteBuffer packet) throws IOException{
		// (view files req c->s) [header | page (4)]
		// (initial response) [header | num files to expect | total num (4)]
		// (list of available clients s->c) [header | size(8) | num_peers(4) | id(4) | name(?)]xNum files
		Map<ServerFile, Integer> files = totalFiles();
		
		//read payload / construct response
		if (packet.capacity() < 4)
			throw new RuntimeException(
					"page not correctly specified");
		
		int page = packet.getInt(0);
		
		int num_to_send = files.size();
		if (files.size() > (Constants.PAGE_SIZE * page))
			num_to_send = Constants.PAGE_SIZE;
		else if (files.size() > (Constants.PAGE_SIZE * (page - 1)))
			num_to_send = files.size() % Constants.PAGE_SIZE;
		else {
			num_to_send = files.size() % Constants.PAGE_SIZE;
			page = (files.size() / Constants.PAGE_SIZE) + 1;
		}
			
		buf = Utility.addHeader(1, 8, client.getId());
		buf.putInt(Constants.HEADER_LEN, num_to_send);
		buf.putInt(Constants.HEADER_LEN + 4, files.size());
		byte[] sendData = buf.array();
		
		// send response
		out.write(sendData);
		out.flush();
		
		//construct/send file infos
		Iterator<ServerFile> it = files.keySet().iterator();
		for (int count = 0; count < ((page - 1) * Constants.PAGE_SIZE); count++)
			it.next();
		for (int count = 0; count < num_to_send; count++) {
			ServerFile f = it.next();
			String sent_name = f.name() + '\0';
			buf = Utility.addHeader(1, sent_name.length() + 16, client.getId());
			buf.putLong(Constants.HEADER_LEN, f.size());
			buf.putInt(Constants.HEADER_LEN + 8, files.get(f)); 
			buf.putInt(Constants.HEADER_LEN + 12, f.id());
			byte[] sent_name_bytes = sent_name.getBytes();
			for (int i = 0; i < sent_name.length(); i++)
				buf.put(Constants.HEADER_LEN + 16 + i, sent_name_bytes[i]);
			sendData = buf.array();
			out.write(sendData);
			out.flush();
		}		
		System.out.println(client.getAddress() + ": Correctly processed file req");
	}