|
|
|
@ -1,16 +1,28 @@
|
|
|
|
|
package clientP2P;
|
|
|
|
|
import clientP2P.ClientManagementUDP;
|
|
|
|
|
import tools.Directories;
|
|
|
|
|
import java.util.Scanner;
|
|
|
|
|
|
|
|
|
|
public class ClientP2P {
|
|
|
|
|
private String host;
|
|
|
|
|
private int port;
|
|
|
|
|
private String dataHomeDirectory;
|
|
|
|
|
public ClientP2P() {
|
|
|
|
|
Directories d = new Directories("P2P_JAVA_PROJECT_CLIENT");
|
|
|
|
|
String os = System.getProperty("os.name");
|
|
|
|
|
|
|
|
|
|
host = "localhost";
|
|
|
|
|
port = 40000;
|
|
|
|
|
dataHomeDirectory = new Directories("P2P_JAVA_PROJECT_CLIENT").getDataHomeDirectory();
|
|
|
|
|
System.out.println("Client will try to contact server at " + host + " on port " + port + ". It will save files in " + dataHomeDirectory);
|
|
|
|
|
dataHomeDirectory = d.getDataHomeDirectory();
|
|
|
|
|
System.out.println("Client will try to contact server at " + host + " on port " + port + ". It will save files in " + dataHomeDirectory);
|
|
|
|
|
if (os.equals("Linux")||os.equals("Mac")||os.equals("Mac OS X")) {
|
|
|
|
|
System.out.println("Do you want to open this directory? (y/N)");
|
|
|
|
|
Scanner scanner = new Scanner(System.in);
|
|
|
|
|
String resp = scanner.nextLine();
|
|
|
|
|
if (resp == "y" || resp == "Y") {
|
|
|
|
|
d.openDataHomeDirectory();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String [] args) {
|
|
|
|
|