Tests en cours sur le TCP

This commit is contained in:
Nabzzz 2020-12-07 19:42:22 +01:00
parent 19ca764685
commit cfca7b6f5a
9 changed files with 7 additions and 8 deletions

View file

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-13">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

Binary file not shown.

Binary file not shown.

View file

@ -95,11 +95,12 @@ class RunnerTCPEnvoi implements Runnable {
String msg;
while(true){
msg = sc.nextLine();
MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1);
if(msg.equals("--STOP--")) {
MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,0);
mh = new MessageHorodate(Destinataire,app.getMe(),msg,0);
out.println(mh);
break;
}
MessageHorodate mh = new MessageHorodate(Destinataire,app.getMe(),msg,1);
out.println(mh);
out.flush();
}
@ -117,7 +118,7 @@ class RunnerTCPEnvoi implements Runnable {
class RunnerTCPEcoute implements Runnable {
final Socket link;
private ChatApp app ;
private Utilisateur u2;
public RunnerTCPEcoute(Socket link,ChatApp app ) {
this.link = link;
this.app = app;
@ -154,6 +155,7 @@ class RunnerTCPEcoute implements Runnable {
app.majHistorique(mh.getSource().getPseudo(), h);
}
else {
u2=mh.getSource();
break;
}
@ -179,6 +181,7 @@ class RunnerTCPEcoute implements Runnable {
}
System.out.println("Finishing thread");
app.getHist(u2.getPseudo()).afficher10derniers();
in.close();

Binary file not shown.

Binary file not shown.