Projet_POO/Projet_POO/src/clavardage/SessionClavardage.java
benassai 6832c6be03 Interface graphique + gestion des noms, de la liste de nom, et des
sessions, fonctionnent (dans certains cas précis, de manière limitée
dans le temps).
2020-12-07 16:51:31 +01:00

57 line
1.5 KiB
Java

package clavardage;
import reseau.*;
public class SessionClavardage {
private String idSource = null;
private String idDestination = null;
private TCPClient clientEmission = null;
private TCPClient clientReception = null;
public SessionClavardage(String idSource, String idDestination, TCPClient clientEmission, TCPClient clientReception) {
this.idSource = idSource;
this.idDestination = idDestination;
this.clientEmission = clientEmission;
this.clientReception = clientReception;
}
public SessionClavardage(String idSource, String idDestination, TCPClient clientReception) {
this.idSource = idSource;
this.idDestination = idDestination;
this.clientReception = clientReception;
}
public void send(String message) {
this.clientEmission.send(message);
}
public void stop() {
if (this.clientEmission != null) this.clientEmission.stop();
if (this.clientReception != null) this.clientReception.stop();
}
public String toString() {
return "Session entre " + this.idSource + " à l'adresse " + this.clientEmission.getAdresseSource()
+ ", et " + this.idDestination + " à l'adresse " + this.clientEmission.getAdresseCible() + "\n";
}
public String getIdSource() {
return this.idSource;
}
public String getIdDestination() {
return this.idDestination;
}
public TCPClient getClientReception() {
return this.clientReception;
}
public void setClientReception(TCPClient client) {
this.clientReception = client;
}
//public void run() {
//}
}