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

class Connexion extends Thread{
  protected Socket client;
  protected DataInputStream in;
  protected PrintStream out;

  public Connexion(Socket client_soc)
    {client=client_soc;
     try
       {in =new DataInputStream(client.getInputStream());
	    out =new PrintStream(client.getOutputStream());}
     catch (IOException e)
       {try {client.close();} catch (IOException e1) {};
	    System.err.println(e.getMessage());
    	return;
       }
     this.start();
    }
    
  public void run()
  { String ligne;
    try
      {while(true)
       {ligne=in.readLine();
	    if (ligne.toUpperCase().compareTo("FIN")==0) break; 
	    out.println(ligne.toUpperCase());
        }}
    catch (IOException e) 
       {System.out.println("connexion :"+e.toString());}
    finally
       {try {client.close();} catch (IOException e){};}
  }
}