Changement pseudo, notif other user, pick a chat
This commit is contained in:
parent
77f2746e17
commit
39b24741a3
6 changed files with 193 additions and 84 deletions
1
Application/Clavardage/bin/.gitignore
vendored
1
Application/Clavardage/bin/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
/RemoteUser.class
|
|
BIN
Application/Clavardage/bin/RemoteUser.class
Normal file
BIN
Application/Clavardage/bin/RemoteUser.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,14 +4,23 @@ import java.util.Date;
|
||||||
import java.util.Scanner; // Import the Scanner class
|
import java.util.Scanner; // Import the Scanner class
|
||||||
import java.util.ArrayList; // import the ArrayList class
|
import java.util.ArrayList; // import the ArrayList class
|
||||||
|
|
||||||
|
|
||||||
public class User{
|
public class User{
|
||||||
|
final static int portUDPlistening_remoteUsr1 = 20001;
|
||||||
|
|
||||||
protected InetAddress addIP;
|
protected InetAddress addIP;
|
||||||
protected String pseudo;
|
protected String pseudo;
|
||||||
protected int nport;
|
|
||||||
|
protected int portUDPsend;
|
||||||
|
protected int portUDPlistening;
|
||||||
|
protected int portTCP;
|
||||||
|
|
||||||
protected boolean actif;
|
protected boolean actif;
|
||||||
|
|
||||||
protected ArrayList<RemoteUser> remoteUserList = new ArrayList<RemoteUser>();
|
protected ArrayList<RemoteUser> remoteUserList = new ArrayList<RemoteUser>();
|
||||||
|
protected ArrayList<RemoteUser> userChatList = new ArrayList<RemoteUser>();
|
||||||
|
|
||||||
|
protected UserListeningThread threadListeningUDP;
|
||||||
public Boolean stopListeningUDPThread=false;
|
public Boolean stopListeningUDPThread=false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -21,7 +30,7 @@ public class User{
|
||||||
* description : On récupère l'adresse de la machine, le numéro de port à utiliser(TODO), on demande un pseudo à l'utilisateur
|
* description : On récupère l'adresse de la machine, le numéro de port à utiliser(TODO), on demande un pseudo à l'utilisateur
|
||||||
* que l'on vérifie, une fois validé, l'utilisateur devient actif (Début de l'écoute UDP pour les pseudos)
|
* que l'on vérifie, une fois validé, l'utilisateur devient actif (Début de l'écoute UDP pour les pseudos)
|
||||||
*/
|
*/
|
||||||
public User(int nport) throws IOException{
|
public User(int portUDPsend,int portUDPlistening,int portTCP) throws IOException{
|
||||||
//localUser
|
//localUser
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -31,37 +40,23 @@ public class User{
|
||||||
System.out.println("Could not find local address!");
|
System.out.println("Could not find local address!");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nport = nport;
|
this.portUDPsend = portUDPsend;
|
||||||
|
this.portUDPlistening = portUDPlistening;
|
||||||
|
this.portTCP = portTCP;
|
||||||
|
|
||||||
this.setPseudo();
|
this.setPseudo();
|
||||||
|
|
||||||
this.actif = true;
|
this.setActif(true);
|
||||||
|
|
||||||
|
|
||||||
UserListeningThread th = new UserListeningThread("UDP Listening thread",this);
|
|
||||||
th.start();
|
|
||||||
//notify_remote_user();
|
|
||||||
//ask_change_pseudo();
|
//ask_change_pseudo();
|
||||||
|
/*
|
||||||
boolean wantstochange = true; //A faire avec un bouton dans SWING
|
boolean wantstochange = true; //A faire avec un bouton dans SWING
|
||||||
if(wantstochange) {
|
if(wantstochange) {
|
||||||
//changePseudo();
|
//changePseudo();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
DatagramSocket dgramSocket= null;
|
//this.waitProgramtoStop()
|
||||||
try {
|
|
||||||
dgramSocket= new DatagramSocket(this.nport,this.addIP);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
String toSend = this.addIP.toString()+":"+this.nport+":"+this.pseudo+":test";
|
|
||||||
//System.out.println("Message avant envoi " +toSend);
|
|
||||||
DatagramPacket outPacket= new DatagramPacket(toSend.getBytes(), toSend.length(),this.addIP, 12229);
|
|
||||||
|
|
||||||
try {
|
|
||||||
dgramSocket.send(outPacket);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remoteUser
|
/* remoteUser
|
||||||
|
@ -72,7 +67,7 @@ public class User{
|
||||||
* description : On récupère l'adresse de la machine, le numéro de port à utiliser(TODO), on demande un pseudo à l'utilisateur
|
* description : On récupère l'adresse de la machine, le numéro de port à utiliser(TODO), on demande un pseudo à l'utilisateur
|
||||||
* que l'on vérifie, une fois validé, l'utilisateur devient actif (Début de l'écoute UDP pour les pseudos)
|
* que l'on vérifie, une fois validé, l'utilisateur devient actif (Début de l'écoute UDP pour les pseudos)
|
||||||
*/
|
*/
|
||||||
public User(int nport,String pseudo) {
|
public User(int portUDPsend,int portUDPlistening, int portTCP,String pseudo) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.addIP = InetAddress.getLocalHost();
|
this.addIP = InetAddress.getLocalHost();
|
||||||
|
@ -81,10 +76,10 @@ public class User{
|
||||||
System.out.println("Could not find local address!");
|
System.out.println("Could not find local address!");
|
||||||
}
|
}
|
||||||
this.pseudo = pseudo;
|
this.pseudo = pseudo;
|
||||||
this.nport = nport;
|
this.portUDPsend = portUDPsend;
|
||||||
this.actif = true;
|
this.portUDPlistening = portUDPlistening;
|
||||||
UserListeningThread th = new UserListeningThread("UDP Listening thread",this);
|
this.portTCP = portTCP;
|
||||||
th.start();
|
this.setActif(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,15 +99,32 @@ public class User{
|
||||||
return pseudo;
|
return pseudo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNport() {
|
public int getPortTCP() {
|
||||||
return nport;
|
return portTCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setNport(int nport) {
|
public void setPortTCP(int portTCP) {
|
||||||
this.nport = nport;
|
this.portTCP = portTCP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPortUDPlistening() {
|
||||||
|
return portUDPlistening;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setPortUDPlistening(int portUDPlistening) {
|
||||||
|
this.portUDPlistening = portUDPlistening;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPortUDPsend() {
|
||||||
|
return portUDPsend;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setPortUDPsend(int portUDPsend) {
|
||||||
|
this.portUDPsend = portUDPsend;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isActif() {
|
public boolean isActif() {
|
||||||
return actif;
|
return actif;
|
||||||
|
@ -120,21 +132,45 @@ public class User{
|
||||||
|
|
||||||
|
|
||||||
public void setActif(boolean actif) {
|
public void setActif(boolean actif) {
|
||||||
this.actif = actif;
|
notify_remote_user();
|
||||||
|
this.threadListeningUDP = new UserListeningThread("UDP Listening thread",this);
|
||||||
|
this.threadListeningUDP.start();
|
||||||
|
|
||||||
|
this.actif=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notify_remote_user() {
|
||||||
|
DatagramSocket dgramSocket= null;
|
||||||
|
try {
|
||||||
|
dgramSocket= new DatagramSocket(portUDPsend,this.addIP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
String toSend = this.addIP.toString()+":"+this.portTCP+":"+this.pseudo+":test";
|
||||||
|
//System.out.println("Message avant envoi " +toSend);
|
||||||
|
DatagramPacket outPacket= new DatagramPacket(toSend.getBytes(), toSend.length(),this.addIP, portUDPlistening_remoteUsr1);
|
||||||
|
|
||||||
|
try {
|
||||||
|
dgramSocket.send(outPacket);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
dgramSocket.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPseudo() throws IOException {
|
public void setPseudo() throws IOException {
|
||||||
Scanner myObj = new Scanner(System.in); // Create a Scanner object
|
Scanner sc1 = new Scanner(System.in); // Create a Scanner object
|
||||||
System.out.println("Enter nickname :");
|
System.out.println("Enter nickname :");
|
||||||
String tmpPseudo = myObj.nextLine(); // Read user input
|
String tmpPseudo = sc1.nextLine(); // Read user input
|
||||||
|
|
||||||
while(!(this.validatePseudo(tmpPseudo))) {
|
while(!(this.validatePseudo(tmpPseudo))) {
|
||||||
System.out.println("Enter another nickname :");
|
System.out.println("Enter another nickname :");
|
||||||
tmpPseudo = myObj.nextLine(); // Read user input
|
tmpPseudo = sc1.nextLine(); // Read user input
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pseudo = tmpPseudo;
|
this.pseudo = tmpPseudo;
|
||||||
myObj.close();
|
//sc1.close();
|
||||||
System.out.println("Your nickname : " + tmpPseudo + " is valid !");
|
System.out.println("Your nickname : " + tmpPseudo + " is valid !");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,12 +179,13 @@ public class User{
|
||||||
|
|
||||||
// Call broadcast
|
// Call broadcast
|
||||||
InetAddress broadcastIP = InetAddress.getLocalHost(); // change to broadcast
|
InetAddress broadcastIP = InetAddress.getLocalHost(); // change to broadcast
|
||||||
|
//System.out.println(broadcastIP);
|
||||||
DatagramSocket dgramSocket = new DatagramSocket(this.nport,this.addIP);
|
DatagramSocket dgramSocket = new DatagramSocket(this.portUDPsend,this.addIP);
|
||||||
|
|
||||||
byte[] buffer = new byte[256];
|
byte[] buffer = new byte[256];
|
||||||
|
|
||||||
DatagramPacket outPacket= new DatagramPacket(tmpPseudo.getBytes(), tmpPseudo.length(),broadcastIP, 12228);
|
String toSend = this.getAddIP()+":"+this.portUDPsend+":test";
|
||||||
|
DatagramPacket outPacket= new DatagramPacket(toSend.getBytes(), toSend.length(),broadcastIP, portUDPlistening_remoteUsr1);
|
||||||
|
|
||||||
dgramSocket.send(outPacket);
|
dgramSocket.send(outPacket);
|
||||||
|
|
||||||
|
@ -164,7 +201,6 @@ public class User{
|
||||||
Boolean arecu;
|
Boolean arecu;
|
||||||
|
|
||||||
System.out.print("Wait for pseudo validation ...\n");
|
System.out.print("Wait for pseudo validation ...\n");
|
||||||
System.out.println("..............");
|
|
||||||
|
|
||||||
int nbReponse =0;
|
int nbReponse =0;
|
||||||
while( (newDate.getTime()-oldDate.getTime()) < 5000 && valid) {
|
while( (newDate.getTime()-oldDate.getTime()) < 5000 && valid) {
|
||||||
|
@ -198,7 +234,6 @@ public class User{
|
||||||
|
|
||||||
newDate = new Date();
|
newDate = new Date();
|
||||||
}
|
}
|
||||||
System.out.println("..............");
|
|
||||||
dgramSocket.close();
|
dgramSocket.close();
|
||||||
|
|
||||||
if(!valid) {
|
if(!valid) {
|
||||||
|
@ -212,49 +247,87 @@ public class User{
|
||||||
RemoteUser tmpRemoteUser = new RemoteUser(remoteUserIP,remoteUserPort,remoteUserPseudo);
|
RemoteUser tmpRemoteUser = new RemoteUser(remoteUserIP,remoteUserPort,remoteUserPseudo);
|
||||||
int index = this.remoteUserList.indexOf(tmpRemoteUser);
|
int index = this.remoteUserList.indexOf(tmpRemoteUser);
|
||||||
if(index!=-1) {
|
if(index!=-1) {
|
||||||
System.out.println("Mise a jour, l'adresse IP(port) de cet utilisateur est déjà présente :"+remoteUserIP+"("+remoteUserPort+")");
|
System.out.println("("+this.pseudo+") - "+"MAJ, IP(port) of user : "+remoteUserPseudo+" => "+remoteUserIP+"("+remoteUserPort+")");
|
||||||
this.remoteUserList.set(index,tmpRemoteUser);
|
this.remoteUserList.set(index,tmpRemoteUser);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Ajout de l'utilisateur ayant pour IP(port) :"+remoteUserIP+"("+remoteUserPort+")");
|
System.out.println("("+this.pseudo+") - "+"Add new user IP(port) of user : "+remoteUserPseudo+" => "+remoteUserIP+"("+remoteUserPort+")");
|
||||||
this.remoteUserList.add(tmpRemoteUser);
|
this.remoteUserList.add(tmpRemoteUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// change pseudo
|
// change pseudo
|
||||||
/*
|
|
||||||
private void changePseudo() throws IOException { //seule différence avec setPseudo c'est qu'on check si on remet pas le même
|
private void changePseudo() throws IOException { //seule différence avec setPseudo c'est qu'on check si on remet pas le même
|
||||||
String oldPseudo = this.pseudo; //Saves the old one for comparison
|
String oldPseudo = this.pseudo; //Saves the old one for comparison
|
||||||
|
|
||||||
Scanner myObj = new Scanner(System.in); // Create a Scanner object
|
Scanner sc3 = new Scanner(System.in); // Create a Scanner object
|
||||||
System.out.println("Enter new nickname :");
|
System.out.println("Enter new nickname :");
|
||||||
String tmpPseudo = myObj.nextLine(); // Read user input
|
String tmpPseudo = sc3.nextLine(); // Read user input
|
||||||
|
|
||||||
while(!(this.validatePseudo(tmpPseudo)) & tmpPseudo.compareTo(oldPseudo) == 0) {
|
while(!(this.validatePseudo(tmpPseudo)) || tmpPseudo.equals(oldPseudo)) {
|
||||||
System.out.println("Enter another nickname :");
|
System.out.println("Enter another nickname :");
|
||||||
tmpPseudo = myObj.nextLine(); // Read user input
|
tmpPseudo = sc3.nextLine(); // Read user input
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pseudo = tmpPseudo;
|
this.pseudo = tmpPseudo;
|
||||||
myObj.close();
|
//myObj.close();
|
||||||
System.out.println("Your new nickname : " + tmpPseudo + " is valid !");
|
System.out.println("Your new nickname : " + tmpPseudo + " is valid !");
|
||||||
|
|
||||||
//notifyothers(); //jsp comment elle s'appelle
|
notify_remote_user();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
public void printRemoteUserList() {
|
||||||
|
System.out.println("Internal list of remote users:\n");
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
for(int i=0; i<this.remoteUserList.size(); i++) {
|
||||||
User usr1 = new User(12228,"Mike");
|
String pseudo = this.remoteUserList.get(i).getPseudo();
|
||||||
|
int Port = this.remoteUserList.get(i).getRemoteUserPort();
|
||||||
|
|
||||||
User usr2 = new User(12229);
|
System.out.println("("+i+")"
|
||||||
|
+"Username: " + pseudo + "\n"
|
||||||
|
+ "IP Adress: " + this.remoteUserList.get(i).getRemoteUserIP() + "\n"
|
||||||
|
+ "Port: " + Port + "\n" + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getOneActiveUser() throws UnknownHostException {
|
||||||
|
Scanner sc2= new Scanner(System.in);
|
||||||
|
System.out.println("Please, enter one active user that you saw on the list to start a conversation with");
|
||||||
|
int index=Integer.parseInt(sc2.nextLine());
|
||||||
|
|
||||||
|
if (index >= 0 && index<remoteUserList.size()) {
|
||||||
|
System.out.println("This user is active, you can start to exchange messages");
|
||||||
|
if(userChatList.contains(remoteUserList.get(index))) {
|
||||||
|
System.out.println("User "+remoteUserList.get(index).getPseudo()+" is already in chat with you");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
userChatList.add(remoteUserList.get(index));
|
||||||
|
System.out.println("New chat with "+remoteUserList.get(index).getPseudo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//sc2.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException, InterruptedException {
|
||||||
|
User usr1 = new User(12221,portUDPlistening_remoteUsr1,22221,"Mike");
|
||||||
|
|
||||||
|
User usr2 = new User(12222,20002,22222);
|
||||||
|
|
||||||
|
|
||||||
//User usr3 = new User(12229);
|
//User usr3 = new User(12229);
|
||||||
|
|
||||||
// Attend une réponse pour fermer l'écoute UDP
|
// Attend une réponse pour fermer l'écoute UDP
|
||||||
|
usr2.printRemoteUserList();
|
||||||
|
usr2.getOneActiveUser();
|
||||||
|
|
||||||
//sleep(1000);
|
usr2.changePseudo();
|
||||||
//usr1.stopListeningUDPThread=true;
|
|
||||||
usr2.stopListeningUDPThread=true;
|
System.out.println("Sleep mode for 5 seconds");
|
||||||
|
Thread.sleep(5000);
|
||||||
|
|
||||||
|
usr1.threadListeningUDP.close();
|
||||||
|
usr2.threadListeningUDP.close();
|
||||||
|
System.out.println("Fin du programme");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,26 +2,26 @@ import java.io.IOException;
|
||||||
import java.net.DatagramPacket;
|
import java.net.DatagramPacket;
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
public class UserListeningThread extends Thread{
|
public class UserListeningThread extends Thread{
|
||||||
|
|
||||||
private User myUser;
|
private User myUser;
|
||||||
|
private DatagramSocket dgramSocket=null;
|
||||||
|
|
||||||
public UserListeningThread(String s,User user) {
|
public UserListeningThread(String s,User user) {
|
||||||
super(s);
|
super(s);
|
||||||
this.myUser = user;
|
this.myUser = user;
|
||||||
}
|
|
||||||
|
|
||||||
public void run(){
|
|
||||||
DatagramSocket dgramSocket= null;
|
|
||||||
try {
|
try {
|
||||||
dgramSocket= new DatagramSocket(this.myUser.getNport(),this.myUser.getAddIP());
|
this.dgramSocket = new DatagramSocket(this.myUser.getPortUDPlistening(),this.myUser.getAddIP());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run(){
|
||||||
|
|
||||||
while(!this.myUser.stopListeningUDPThread) {
|
while(true) {
|
||||||
|
|
||||||
|
|
||||||
byte[] buffer = new byte[256];
|
byte[] buffer = new byte[256];
|
||||||
|
@ -33,25 +33,62 @@ public class UserListeningThread extends Thread{
|
||||||
}
|
}
|
||||||
buffer = inPacket.getData();
|
buffer = inPacket.getData();
|
||||||
|
|
||||||
System.out.println("Listening thread UDP : "+new String(buffer));
|
String receiveMsg = new String(buffer);
|
||||||
|
String [] tabMsg = receiveMsg.split(":");
|
||||||
|
|
||||||
InetAddress itsIP=inPacket.getAddress();
|
if(tabMsg.length==3) { // si demande d'information d'un nouvelle utilisateur
|
||||||
int itsPort=inPacket.getPort();
|
InetAddress itsIP = null;
|
||||||
|
try {
|
||||||
|
itsIP = InetAddress.getByName(tabMsg[0].split("/")[1]);
|
||||||
|
} catch (UnknownHostException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
int senderUDPport = Integer.parseInt(tabMsg[1]);
|
||||||
|
|
||||||
String toSend = myUser.getAddIP().toString()+":"+myUser.getNport()+":"+myUser.getPseudo()+":test";
|
//int itsPort=inPacket.getPort();
|
||||||
//System.out.println("Message avant envoi " +toSend);
|
|
||||||
DatagramPacket outPacket= new DatagramPacket(toSend.getBytes(), toSend.length(),itsIP, 12229);
|
|
||||||
|
|
||||||
try {
|
String toSend = myUser.getAddIP().toString()+":"+myUser.getPortTCP()+":"+myUser.getPseudo()+":test";
|
||||||
dgramSocket.send(outPacket);
|
//System.out.println("Message avant envoi " +toSend);
|
||||||
} catch (IOException e) {
|
DatagramPacket outPacket= new DatagramPacket(toSend.getBytes(), toSend.length(),itsIP, senderUDPport);
|
||||||
e.printStackTrace();
|
|
||||||
|
// System.out.println("message avant envoi :"+toSend);
|
||||||
|
try {
|
||||||
|
dgramSocket.send(outPacket);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // Si un nouvelle utilisateur passe en mode actif
|
||||||
|
//System.out.println("\tIP : "+tabMsg[0]);
|
||||||
|
//System.out.println("\tn°Port : "+tabMsg[1]);
|
||||||
|
//System.out.println("\tpseudo : "+tabMsg[2]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.myUser.addRemoteUser(InetAddress.getByName(tabMsg[0].split("/")[1]),Integer.parseInt(tabMsg[1]),tabMsg[2]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
dgramSocket.close();
|
|
||||||
System.out.println("Fin du thread "+this.myUser.getNport());
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
this.dgramSocket.close();
|
||||||
|
System.out.println("Fin du thread "+this.myUser.getPseudo());
|
||||||
|
try {
|
||||||
|
this.interrupt();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue