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"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <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"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

Binary file not shown.

Binary file not shown.

View file

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

Binary file not shown.

Binary file not shown.