TD2: CRLF -> LF conversion.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 12 Mar 2018 22:05:59 +0000 (23:05 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 12 Mar 2018 22:05:59 +0000 (23:05 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TD2/server/EchoServerThreadService.java
TD2/server/Main.java

index e04d18f3c52bb2bdb06cd97c93ecfe6af31bc308..257f15c4d654dd587b82720d9d59189fb5ef4a1b 100644 (file)
@@ -1,58 +1,58 @@
-import java.net.*;\r
-import java.io.*;\r
-import java.util.*;\r
-\r
-public class EchoServerThreadService implements Runnable {\r
-\r
-       private Socket clientSocket;\r
-       private ArrayList<PrintWriter> listWriter;\r
-\r
-       EchoServerThreadService(Socket clientSocket) {\r
-               System.out.println("Creation d'un thread pour repondre a un client, port " + clientSocket.getPort());\r
-               this.clientSocket = clientSocket;\r
-       }\r
-\r
-       public void run() {\r
-               try {\r
-                       doService(clientSocket);\r
-                       clientSocket.close();\r
-               } catch (IOException e) {\r
-                       System.err.println("IOException : " + e);\r
-                       e.printStackTrace();\r
-               }\r
-               finally {\r
-                       try {\r
-                               if (this.clientSocket != null)\r
-                                       this.clientSocket.close();\r
-                       } catch (IOException e) {\r
-                               System.err.println("IOException : " + e);\r
-                               e.printStackTrace();\r
-                       }\r
-               }\r
-       }\r
-\r
-       public void doService(Socket clientSocket) throws IOException {\r
-               BufferedReader in;\r
-               PrintStream out;\r
-               in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));\r
-               out = new PrintStream(clientSocket.getOutputStream());\r
-               //listWriter.add(new PrintWriter(clientSocket.getOutputStream()));\r
-               boolean end = false;\r
-               while (!end) {\r
-                       String theLine = in.readLine();\r
-                       if (theLine.equals("."))\r
-                               end = true; // le thread de service doit terminer\r
-                       out.println(theLine);\r
-               }\r
-               System.out.println("Fin du thread repondant au client, port "\r
-                                                       + clientSocket.getPort());\r
-       }\r
-\r
-       public void broadcastMsg(String msg) {\r
-               for (int i = 0; i < listWriter.size(); i++) {\r
-                       listWriter.get(i);\r
-               }\r
-\r
-       }\r
-\r
-}\r
+import java.net.*;
+import java.io.*;
+import java.util.*;
+
+public class EchoServerThreadService implements Runnable {
+
+       private Socket clientSocket;
+       private ArrayList<PrintWriter> listWriter;
+
+       EchoServerThreadService(Socket clientSocket) {
+               System.out.println("Creation d'un thread pour repondre a un client, port " + clientSocket.getPort());
+               this.clientSocket = clientSocket;
+       }
+
+       public void run() {
+               try {
+                       doService(clientSocket);
+                       clientSocket.close();
+               } catch (IOException e) {
+                       System.err.println("IOException : " + e);
+                       e.printStackTrace();
+               }
+               finally {
+                       try {
+                               if (this.clientSocket != null)
+                                       this.clientSocket.close();
+                       } catch (IOException e) {
+                               System.err.println("IOException : " + e);
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       public void doService(Socket clientSocket) throws IOException {
+               BufferedReader in;
+               PrintStream out;
+               in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
+               out = new PrintStream(clientSocket.getOutputStream());
+               //listWriter.add(new PrintWriter(clientSocket.getOutputStream()));
+               boolean end = false;
+               while (!end) {
+                       String theLine = in.readLine();
+                       if (theLine.equals("."))
+                               end = true; // le thread de service doit terminer
+                       out.println(theLine);
+               }
+               System.out.println("Fin du thread repondant au client, port "
+                                                       + clientSocket.getPort());
+       }
+
+       public void broadcastMsg(String msg) {
+               for (int i = 0; i < listWriter.size(); i++) {
+                       listWriter.get(i);
+               }
+
+       }
+
+}
index c0504484646b86eab93404b4521c6a25ccfe8bfe..00d4f9eee7e4264cc8ed340a29fe641f311cfd29 100644 (file)
@@ -1,31 +1,31 @@
-import java.net.*;\r
-import java.io.*;\r
-\r
-public class Main {\r
-       public static void main(String[] args) {\r
-               ServerSocket listenSocket = null;\r
-               try {\r
-                       listenSocket = new ServerSocket(Integer.parseInt(args[0])); // port\r
-                       while (true) { // le dispatcher est le thread qui execute main()\r
-                               Socket clientSocket = listenSocket.accept();\r
-                               System.out.println("Connexion de :" + clientSocket.getInetAddress());\r
-                               Thread serviceThread = new Thread(new EchoServerThreadService(clientSocket));\r
-                               serviceThread.start();\r
-                       }\r
-               }\r
-               catch (Exception e) {\r
-                       System.err.println("IOException : " + e);\r
-                       e.printStackTrace();\r
-               }\r
-               finally {\r
-                       try {\r
-                               if (listenSocket != null)\r
-                                       listenSocket.close();\r
-                       } catch (IOException e) {\r
-                               System.err.println("IOException : " + e);\r
-                               e.printStackTrace();\r
-                       }\r
-               }\r
-       }\r
-\r
-}\r
+import java.net.*;
+import java.io.*;
+
+public class Main {
+       public static void main(String[] args) {
+               ServerSocket listenSocket = null;
+               try {
+                       listenSocket = new ServerSocket(Integer.parseInt(args[0])); // port
+                       while (true) { // le dispatcher est le thread qui execute main()
+                               Socket clientSocket = listenSocket.accept();
+                               System.out.println("Connexion de :" + clientSocket.getInetAddress());
+                               Thread serviceThread = new Thread(new EchoServerThreadService(clientSocket));
+                               serviceThread.start();
+                       }
+               }
+               catch (Exception e) {
+                       System.err.println("IOException : " + e);
+                       e.printStackTrace();
+               }
+               finally {
+                       try {
+                               if (listenSocket != null)
+                                       listenSocket.close();
+                       } catch (IOException e) {
+                               System.err.println("IOException : " + e);
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+}