import java.io.*; import java.net.*; import java.util.*; class Connexion extends Thread { protected Socket client; protected Serveur serveur; protected Nettoyeur nettoyeur; protected BufferedReader in; protected PrintStream out; // pour attribuer un identificateur unique private static int numero = 0; private static char[] listeEquipe = {'N','S','E','O'}; // des informations sur le client private int ident; private char equipe; public Connexion(Socket clientSocket, Nettoyeur n, Serveur s) { client = clientSocket; nettoyeur = n; serveur = s; ident = numero; numero++; equipe = listeEquipe[ident % listeEquipe.length]; try { in=new BufferedReader(new InputStreamReader(client.getInputStream())); out = new PrintStream(client.getOutputStream()); } catch(IOException e) { try { client.close(); } catch(IOException el) {} System.err.println(e.getMessage()); return; } } public String toString(String motClef){ return motClef + " " + String.valueOf(ident)+ " " + equipe; } public void run() { String ligne; Connexion c; try { synchronized(serveur.connexions) { for (int i = 0; i