Implementation TCP

This commit is contained in:
Nabil Moukhlis 2020-12-05 13:01:02 +01:00
parent aecd3e2692
commit 5a20c9fd06
3 changed files with 3 additions and 1 deletions

View file

@ -96,7 +96,7 @@ class RunnerTCPEnvoi implements Runnable {
while(true){ while(true){
msg = sc.nextLine(); msg = sc.nextLine();
MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1); MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1);
out.println(mh.toString()); out.println(msg);
out.flush(); out.flush();
} }
} }
@ -123,8 +123,10 @@ class RunnerTCPEcoute implements Runnable {
String line = in.readLine(); String line = in.readLine();
String msg = ""; String msg = "";
while (line != null) { while (line != null) {
//if(!msg.equals("")) { //if(!msg.equals("")) {
System.out.println("Received: "+ line); System.out.println("Received: "+ line);
line = in.readLine();
//} //}
/*if((line.split(" ")[0].equals("Destinataire"))) { /*if((line.split(" ")[0].equals("Destinataire"))) {
if(msg != "") { if(msg != "") {