|
|
|
@ -1,7 +1,8 @@
|
|
|
|
|
package clientP2P;
|
|
|
|
|
import clientP2P.ClientManagementUDP;
|
|
|
|
|
import clientP2P.ClientManagementTCP;
|
|
|
|
|
import tools.Directories;
|
|
|
|
|
|
|
|
|
|
import java.util.Scanner;
|
|
|
|
|
|
|
|
|
|
public class ClientP2P {
|
|
|
|
|
private String host;
|
|
|
|
@ -17,7 +18,22 @@ public class ClientP2P {
|
|
|
|
|
|
|
|
|
|
public static void main(String [] args) {
|
|
|
|
|
ClientP2P c = new ClientP2P();
|
|
|
|
|
ClientManagementUDP cm = new ClientManagementUDP(c.directories.getDataHomeDirectory(), c.host, c.port);
|
|
|
|
|
System.out.println("Which transport protocol do you want to use? [TCP/udp]");
|
|
|
|
|
Scanner sc = new Scanner(System.in);
|
|
|
|
|
String transportchoosen = sc.nextLine();
|
|
|
|
|
switch(transportchoosen){
|
|
|
|
|
case "UDP":
|
|
|
|
|
case "udp":
|
|
|
|
|
case "2" :
|
|
|
|
|
ClientManagementUDP cm = new ClientManagementUDP(c.directories.getDataHomeDirectory(), c.host, c.port);
|
|
|
|
|
break;
|
|
|
|
|
case "TCP":
|
|
|
|
|
case "tcp":
|
|
|
|
|
case "1":
|
|
|
|
|
default:
|
|
|
|
|
ClientManagementTCP cm = new ClientManagementTCP(c.directories.getDataHomeDirectory(), c.host, c.port);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Thread t = new Thread(cm);
|
|
|
|
|
t.setName("client P2P-JAVA-PROJECT");
|
|
|
|
|
t.start();
|
|
|
|
|