public static void main(String args[]) 
	{
		Scanner in = new Scanner(System.in);
		System.out.println("Enter computer ID:");
		id = Integer.parseInt(in.nextLine());
		System.out.println("Enter port address for this computer:");
		port = Integer.parseInt(in.nextLine());
		server s = new server();
		stateThread st = new stateThread();
		s.setDaemon(true);
		st.setDaemon(true);
		s.start();	//Starts listening for client connections.
		st.start();
		//Creates all necessary files that do not exist.
		try{
			file = new File("file_"+id+".txt");
			p2p_file = new File("p2p.txt");
			if(!file.exists())
				file.createNewFile();
			if(!p2p_file.exists())
				p2p_file.createNewFile();
		}
		catch(Exception e){
			e.printStackTrace();
		}
		writeFileNames();	//Writes all files in sub-directory to the file_id.txt.
		readFileNames();	//Reads all lines from file_id.txt into file_list.
		joinP2PSystem();	//Initiates the process of joining P2P network.
		do{
			System.out.println("What would you like to do? \n 1.Search and download a file."
					+"\n 2.Exit the P2P network. \n Enter your choice:");
			choice = Integer.parseInt(in.nextLine());
			if(choice==1)
			{
				System.out.println("Enter the file name or keyword:");
				String file = in.nextLine();
				new search(file);
			}
			else if(choice==2)
			{
				depart = true;
				if(neighbor_list.size()>0)
					new depart();					
			}
			else
				System.out.println("Invalid option.");
		}while(choice!=2);
		s.interrupt();
		st.interrupt();
		removeFromActiveP2PSystem();
		in.close();
		System.out.println("System has gone offline.");
	}