TD2: Make the IHM client with one receive thread and one send thread.
[TD_SR.git] / TD2 / IHM / ThreadIHMSend.java
1 import java.io.*;
2
3 public class ThreadIHMSend implements Runnable {
4 private SocketClient client;
5 private IHM clientIHM;
6
7 ThreadIHMSend(SocketClient c, IHM ui) {
8 client = c;
9 clientIHM = ui;
10 }
11
12 public void run() {
13 BufferedReader userInput = null;
14 try {
15 boolean end = false;
16 while (!end) {
17 String line = clientIHM.getNextMessageToSend();
18 if (line.equals(".")) {
19 end = true;
20 }
21 client.sendMsg(line);
22 System.out.println(Thread.currentThread().getName() + " a envoye " + line);
23 }
24 }
25 catch (Exception e) {
26 System.err.println("Exception: " + e);
27 e.printStackTrace();
28 }
29 }
30 }