//
// classe de dialogue commune aux deux
//

import java.io.*;
import java.net.*;

public class dial {


  public dial(){

  }

  int waitMessage(){
    int j=0;
    try {
      while(true){
	for(j=0;j<nbJCon;j++) { // pour chaque joueur connecte
	  // read in a line
	  if(in[j].available()<0){System.out.println("not available on "+j);}
	  if(in[j].available()>0) return j;
	}
	
      }
      //System.out.println("fin du jeu");
    }catch (IOException e) { try{jSocket[j].close();}catch(Exception e2){;} }
    //finally { ; }
    return 0;
  }  

  String getMessage(int j){
    try {
      String line = in[j].readLine();
      if (line == null) System.out.println("bye bye "+j);
      else return line;
    }catch (IOException e) {try{jSocket[j].close();}catch(Exception e2){;} }
    return "";
  }
