Remove debugs print
This commit is contained in:
parent
ecc92f79d1
commit
789c0c0257
@ -48,7 +48,7 @@ public class ClientManagementUDP implements Runnable {
|
||||
msg = sendMsg(sendDownloadRequest(f));
|
||||
download(msg, f);
|
||||
} catch (TransmissionError e) {
|
||||
System.out.println("TransmissionError");
|
||||
System.out.println("Transmission error");
|
||||
} catch (ProtocolError e) {
|
||||
System.out.println("Protocol error");
|
||||
} catch (NotFound e) {
|
||||
@ -143,11 +143,8 @@ public class ClientManagementUDP implements Runnable {
|
||||
DatagramPacket reception = new DatagramPacket(buffer, buffer.length);
|
||||
DatagramPacket emission = new DatagramPacket(buffer, buffer.length, dst, UDPPort);
|
||||
socket.send(emission);
|
||||
System.out.print(msg);
|
||||
socket.receive(reception);
|
||||
String tmp = new String(reception.getData(), 0, reception.getLength());
|
||||
System.out.print(tmp);
|
||||
return tmp;
|
||||
return new String(reception.getData(), 0, reception.getLength());
|
||||
} catch (Exception e){
|
||||
throw new TransmissionError();
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public class ClientP2P {
|
||||
// create directory if not already exists
|
||||
new File(d).mkdirs();
|
||||
directory = d;
|
||||
System.out.println("Client will try to contact server at " + host + " on port " + port + ". It will save files in " + directory);
|
||||
}
|
||||
|
||||
public static void main(String [] args) {
|
||||
|
@ -67,19 +67,18 @@ public class ServerManagementUDP implements Runnable {
|
||||
* @return data to be send as response
|
||||
*/
|
||||
String processRequest(String request) {
|
||||
System.out.print(request);
|
||||
String res = protocolID + "\n";
|
||||
String formattedRequest[] = request.split("\n");
|
||||
try {
|
||||
try {
|
||||
checkProtocolID(formattedRequest[0]);
|
||||
System.out.print("juste avant le switch");
|
||||
switch (formattedRequest[1]) {
|
||||
case "LIST":
|
||||
System.out.print("liste detectee");
|
||||
System.out.println("List request");
|
||||
res += sendFileList();
|
||||
break;
|
||||
case "DOWNLOAD":
|
||||
System.out.println("Download request: " + formattedRequest[2]);
|
||||
res += upload(formattedRequest[2]);
|
||||
break;
|
||||
default:
|
||||
@ -102,7 +101,6 @@ public class ServerManagementUDP implements Runnable {
|
||||
/** Initialize local list of all files allowed to be shared.
|
||||
*/
|
||||
private void initFileList() {
|
||||
System.out.println(baseDirectory);
|
||||
File folder = new File(baseDirectory);
|
||||
File[] files = folder.listFiles();
|
||||
/* Add non-recursively files's names to fileList */
|
||||
@ -119,7 +117,6 @@ public class ServerManagementUDP implements Runnable {
|
||||
* @throws ProtocolError
|
||||
*/
|
||||
private void checkProtocolID(String msgProtocolID) throws ProtocolError {
|
||||
System.out.print(msgProtocolID + "\n" + protocolID);
|
||||
if (!protocolID.equals(msgProtocolID)) {
|
||||
throw new ProtocolError();
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ public class ServerP2P {
|
||||
// create directory if not already exists
|
||||
new File(d).mkdirs();
|
||||
directory = d;
|
||||
System.out.println("Server will listen on port " + port + " and serve files from " + directory);
|
||||
}
|
||||
public static void main(String [] args) {
|
||||
ServerP2P s = new ServerP2P();
|
||||
|
Loading…
Reference in New Issue
Block a user