Phase de test TCP
This commit is contained in:
parent
a8e9a1876d
commit
af0f76c780
3 changed files with 9 additions and 0 deletions
Binary file not shown.
Binary file not shown.
|
@ -6,6 +6,7 @@ import java.net.DatagramSocket;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -118,7 +119,11 @@ class RunnerTCPEnvoi implements Runnable {
|
||||||
out.flush();
|
out.flush();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
try {
|
||||||
msg = sc.nextLine();
|
msg = sc.nextLine();
|
||||||
|
}catch(NoSuchElementException e) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1);
|
MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1);
|
||||||
if(msg.equals("--STOP--")) {
|
if(msg.equals("--STOP--")) {
|
||||||
mh = new MessageHorodate(Destinataire,app.getMe(),msg,0);
|
mh = new MessageHorodate(Destinataire,app.getMe(),msg,0);
|
||||||
|
@ -223,6 +228,10 @@ class RunnerTCPEcoute implements Runnable {
|
||||||
else if(line.split("::")[0].equals("Date")) {
|
else if(line.split("::")[0].equals("Date")) {
|
||||||
date = line+"\n";
|
date = line+"\n";
|
||||||
}
|
}
|
||||||
|
else if(line.split("::")[0].equals("Message")){
|
||||||
|
payload = line+"\n";
|
||||||
|
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
payload += line+"\n";
|
payload += line+"\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue