Code cleanups.
[TD_SR.git] / TD2 / client / ThreadClientSend.java
CommitLineData
e018d1ec 1import java.io.*;
2c648f75
JB
2
3public class ThreadClientSend implements Runnable {
4 private SocketClient client;
2c648f75
JB
5
6 ThreadClientSend(SocketClient c) {
7 client = c;
8 }
9
2c648f75 10 public void run() {
e018d1ec
JB
11 BufferedReader userInput = null;
12 try {
13 userInput = new BufferedReader(new InputStreamReader(System.in));
14 boolean end = false;
15 while (!end) {
16 String line = userInput.readLine();
6b300998 17 if (line.equals(".")) {
e018d1ec
JB
18 end = true;
19 }
20 client.sendMsg(line);
21 System.out.println(Thread.currentThread().getName() + " a envoye " + line);
2c648f75 22 }
6b300998 23 }
e018d1ec
JB
24 catch (IOException e) {
25 System.err.println("IOException: " + e);
26 e.printStackTrace();
27 }
28 finally {
29 if (userInput != null) {
6b300998
JB
30 try {
31 userInput.close();
32 }
33 catch (IOException e) {
34 System.err.println("IOException: " + e);
35 }
36 }
2c648f75
JB
37 }
38 }
39}