@@ -0,0 +1,1240 @@
+package reseau_tp_1;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.BufferedWriter;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.io.OutputStreamWriter;%0Aimport java.net.ServerSocket;%0Aimport java.net.Socket;%0Aimport java.util.GregorianCalendar;%0A%0Apublic class ServerTCPEcho %7B%0A%09private int port;%0A%09%0A%09public ServerTCPEcho(int port) throws IOException%7B%0A%09%09this.port = port;%0A%09%09run();%0A%09%7D%0A%09%0A%09private void run() throws IOException%7B%0A%09%09Socket client;%0A%09%09BufferedWriter out;%0A%09%09BufferedReader in;%0A%09%09String ligne;%0A%09%09ServerSocket server = new ServerSocket(this.port);%0A%09%09for(;;)%7B%0A%09%09%09client = server.accept();%0A%09%09%09out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));%0A%09%09%09String date = new GregorianCalendar().getTime().toString();%0A%09%09%09out.write(date);%0A%09%09%09out.newLine();%0A%09%09%09out.flush();%0A%09%09%09%0A%09%09%09BufferedReader br = new BufferedReader(new InputStreamReader(client.getInputStream()));%0A%09%09%09%0A%09%09%09%0A%09%09%09while((ligne = br.readLine())!=null)%7B%0A%09%09%09%09out.write(ligne.toUpperCase());%0A%09%09%09%09out.newLine();%0A%09%09%09%09out.flush();%0A%09%09%09%7D%0A%09%09%09br.close();%0A%09%09%09client.close();%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static void main(String%5B%5D args) %7B%0A%09%09try %7B%0A%09%09%09ServerTCPEcho server = new ServerTCPEcho(5015);%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Create ServerTCPEcho.java