Tests sur le TCP
This commit is contained in:
parent
e7d01f5e35
commit
7b0e6f4db2
4 changed files with 5 additions and 2 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -84,12 +84,14 @@ class RunnerTCPEnvoi implements Runnable {
|
|||
private boolean bonjourEnvoye = false;
|
||||
|
||||
public RunnerTCPEnvoi(Socket link,ChatApp app, Utilisateur user2, boolean bonjour ) throws IOException {
|
||||
|
||||
this.link = link;
|
||||
this.app = app;
|
||||
this.Destinataire = user2;
|
||||
this.out = new PrintWriter(link.getOutputStream());
|
||||
this.in = new BufferedReader (new InputStreamReader (link.getInputStream()));
|
||||
this.bonjourEnvoye = bonjour;
|
||||
this.run();
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -177,8 +179,9 @@ class RunnerTCPEcoute implements Runnable {
|
|||
}
|
||||
else if(line.split(":")[0].equals("Type")) {
|
||||
if(line.split(":")[1].equals("2")) {
|
||||
System.out.println("Bonjour reçu!");
|
||||
u2=Utilisateur.stringToUtilisateur(src.split(":")[1]);
|
||||
System.out.println("Bonjour recu!");
|
||||
System.out.println(src.split(":")[1].replaceAll("\n", ""));
|
||||
u2=Utilisateur.stringToUtilisateur(src.split(":")[1].replaceAll("\n", ""));
|
||||
new Thread(new RunnerTCPEnvoi(link,app,u2,true));
|
||||
}
|
||||
type = line+"\n";
|
||||
|
|
Loading…
Reference in a new issue