View Single Post
  #1 (permalink)  
Old August 4th, 2009
2eXtreme 2eXtreme is offline
Novicius
 
Join Date: August 4th, 2009
Posts: 2
2eXtreme is flying high
Default [Wanted] Simple Phex API Tutorial - how to do a search?

Hi Guys,

I've posted in another thread, but I've deiced I like Phex best, out of all my attempted routes at Gnutella development.

The thing is, I'd really love a tutorial on how to do a simple search with the Phex API?

When I say simple, I'm hoping for only a few classes to be used, with the code something like:

Code:
//Main.java

public class Main{

public static void main(String [] args){
new Main(args);
}

public Main(String [] items){
if (items.length == 1){
new Search(items[0]);
}
}
} 

//Search.java

public class Search{
public Search(String searchForThis){
//Connect to Gnutella
//Search network for search term
//Calls a method that adds files to result list
addResult(fileN);
//after network has been searched
System.out.println("Finished searching!");
}
public void addResult(File myFile){
//adds a file to an array list of files
myResults.add(myFile);
System.out.println("Found: " +myFile.getName());
}
}

//File.java
public class File{
public String getName(){
return this.name;
}
//other members
}
Reply With Quote