X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TD2%2Fclient%2FThreadClientSend.java;h=399cfd3139f819247e3a301fe9c88a52b0ed9724;hb=8c3c3f613303ed9670d122cf1aa6f1fc89e8223b;hp=59ffbd0bab538c80a6b6f82f3ab094089fa7f7d1;hpb=e018d1ec033513412d9b3628a7d6701a48725382;p=TD_SR.git diff --git a/TD2/client/ThreadClientSend.java b/TD2/client/ThreadClientSend.java index 59ffbd0..399cfd3 100644 --- a/TD2/client/ThreadClientSend.java +++ b/TD2/client/ThreadClientSend.java @@ -1,4 +1,3 @@ -import java.util.concurrent.ThreadLocalRandom; import java.io.*; public class ThreadClientSend implements Runnable { @@ -13,28 +12,29 @@ public class ThreadClientSend implements Runnable { try { userInput = new BufferedReader(new InputStreamReader(System.in)); boolean end = false; - while (!end) { - String line = userInput.readLine(); - if (line.equals(".")) { + while (!end) { + String line = userInput.readLine(); + if (line.equals(".")) { end = true; } client.sendMsg(line); System.out.println(Thread.currentThread().getName() + " a envoye " + line); } - } + } catch (IOException e) { System.err.println("IOException: " + e); e.printStackTrace(); } finally { if (userInput != null) { - try { - userInput.close(); - } - catch (IOException e) { - System.err.println("IOException: " + e); - } - } + try { + userInput.close(); + } + catch (IOException e) { + System.err.println("IOException: " + e); + e.printStackTrace(); + } + } } } }