From ecc92f79d1b4ab7d00d1933643516d599cf927b6 Mon Sep 17 00:00:00 2001 From: flavien Date: Tue, 14 Jan 2020 11:55:02 +0100 Subject: [PATCH] erreurs --- src/P2P_JAVA_PROJECT_SERVER/bonjour | 1 + src/clientP2P/ClientManagementUDP.class | Bin 3676 -> 3771 bytes src/clientP2P/ClientManagementUDP.java | 7 +++++-- src/clientP2P/ClientP2P.class | Bin 1552 -> 1562 bytes src/clientP2P/ClientP2P.java | 3 ++- src/serverP2P/ServerManagementUDP.class | Bin 3973 -> 4214 bytes src/serverP2P/ServerManagementUDP.java | 17 +++++++++++------ src/serverP2P/ServerP2P.class | Bin 1480 -> 1490 bytes src/serverP2P/ServerP2P.java | 3 ++- 9 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 src/P2P_JAVA_PROJECT_SERVER/bonjour diff --git a/src/P2P_JAVA_PROJECT_SERVER/bonjour b/src/P2P_JAVA_PROJECT_SERVER/bonjour new file mode 100644 index 0000000..1cd909e --- /dev/null +++ b/src/P2P_JAVA_PROJECT_SERVER/bonjour @@ -0,0 +1 @@ +bonjour diff --git a/src/clientP2P/ClientManagementUDP.class b/src/clientP2P/ClientManagementUDP.class index e4928ecaca96f1b6a29ab87d3ef3e18ad66c7359..de712c00f5a6c19210acfb75c1b0f12011b056f4 100644 GIT binary patch delta 1325 zcmY+D`%_e97{@2;Y<77+3G&vMYH;TX#+`JS)bU|Bji4bwc?r5ZT zQBjX5Y1zH(jzC~;LD^L+D=WJ>(=`3kAJB}yWc55pCa2kRzVGus&+~n5=h+T!g7T!g%uIfthDKNSjF9rXzo$CSK&UJ`wb7M$Ab=2=uud$ zmNg0w8G3CVHmtQ-XIO9Zh~ZJ2#|)3#Z0Ip;bU2F+!zP#(Q~Uq6`sb}X49{i z?KV3c^679G;0e|2bjVfiE{6+vQsF6u-G-+P&)7U`^PKuU@9+XIs`QfKWrqqS?Qy8Q zkXHnGRaLKPcdx7ThT%6Lz@8R$gtRkh(` zmrwZAN$S&!ysZp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FQ>?id4lWxl&AYlB-Ir=+w#8Va1hGTr-v{u~2j} svq7oaXy;mQKF<`MpRcI7xShRhU|*1@^u%e}4TZDGO6?tbg8z2szmG59H~;_u diff --git a/src/clientP2P/ClientManagementUDP.java b/src/clientP2P/ClientManagementUDP.java index 63d4374..3cd83c3 100644 --- a/src/clientP2P/ClientManagementUDP.java +++ b/src/clientP2P/ClientManagementUDP.java @@ -125,7 +125,7 @@ public class ClientManagementUDP implements Runnable { * @throws ProtocolError */ private void checkProtocolID(String msgProtocolID) throws ProtocolError { - if (protocolID != msgProtocolID) { + if (!protocolID.equals(msgProtocolID)) { throw new ProtocolError(); } } @@ -143,8 +143,11 @@ 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); - return new String(reception.getData(), 0, reception.getLength()); + String tmp = new String(reception.getData(), 0, reception.getLength()); + System.out.print(tmp); + return tmp; } catch (Exception e){ throw new TransmissionError(); } diff --git a/src/clientP2P/ClientP2P.class b/src/clientP2P/ClientP2P.class index c0f85c682277a534fa42010e9a81951cb7f3fb42..bec0ac804cb39ec7ef021b6570724dae73f832a8 100644 GIT binary patch delta 174 zcmbQhGmB?}2)8tYIWq&p90yJY>51|I!a$0_kDbAv3rL%?GX!uk$WCl(XY`-U#rU2{ zQh)LB#L2GCsQ*WFxh=Fi1^4#Huf^!ob0x${@p_1|-!P Sv>7xQ^nuneG8lsmF#!OhejmI5 delta 162 zcmbQmGl6G<2)7i2IWq&p90yJYsfqFd!t4xwTnthSrtA#VrzN{?}u~0%6DJ)LF{V;Vrfarq?54o|#jinM=CYzSIv0RK5Zage{r5lg9@uMLJ!jq!cDXbU$lw9?+!ZSKL;#m0ue#$$qkL$dZR4jXt6 zdkwrVTQ9IKv$poSWqfd2Bve?S@PUCN_)y^^10SQ%9PP**@CiOOP=G=WNmHg5M}l60 zEQol+L2vQR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)Vi$206zw1 zmfE$7h6{V?dZpIRP?YEMRnB9b9%8wG@7h8>haM!Nz)Ck1_RBuBQMgsXqeWbTlg_;U zq?|VvV&gA!ciUoipb5|BGg>iOV2S+uKr1Y>V%nj#LO!=0tSE~9d>aDs&M>}{ngXdU zhJ~ebpnQqt(8>F6l@t1MVv_0t^Wh#uh^ZRv#}FBJ8M=&sP6neIAz3l@8iX7~@<9x( z!u0{0z{JHe*bQ}Yl}sd=V9miWCL(jt3&Er-NLPaWFGUwlKr+f`w2o$LFb`{4!+NWr zNI3pRd+AXFQs8KWmMzPXD_Rh2RU5?6eK~M8c@+a#uHj0sOn2XyCSdt7JU#XhQZ$q! zioysDN8k%-EJ?0`lohJ`F_NXGRW#HGsufk^b|oWTDWjd$O_LyOL}zRwteY_yTdb^G z$&1p$n!wvHA&wq=n*(`;lgqWXyGK~?21y1_b_OplAZ^6X;LXJ#J+Z2R(QD%GdrXr0lW#E^vhpyf zGN?`FX0q7q!StAsQF5{liz+8S12Y2?0|Ud7$x$rxgtWA`GDvI$a+w&kfTR@z-(*%+ zQ|84C@{=uD&G{rFw=+oj>}HUT)ZW4%F}aRaTV9cYgF%Twf#*@e}NPa<+V ugQU-H2B}ExEez6=J6N^l6&N@e6oHl~0ZC;Bbp{m%Z3a~aMg{}00fqonW*b!i diff --git a/src/serverP2P/ServerP2P.java b/src/serverP2P/ServerP2P.java index 33338e3..5517180 100644 --- a/src/serverP2P/ServerP2P.java +++ b/src/serverP2P/ServerP2P.java @@ -24,9 +24,10 @@ public class ServerP2P { } else { d = "."; } - d += "P2P_JAVA_PROJECT_SERVER/"; + d += "/P2P_JAVA_PROJECT_SERVER/"; // create directory if not already exists new File(d).mkdirs(); + directory = d; } public static void main(String [] args) { ServerP2P s = new ServerP2P();