Commit | Line | Data |
---|---|---|
c4aaaeca JB |
1 | import java.io.*; |
2 | ||
3 | public class ThreadClientoReceive implements Runnable { | |
4 | private SocketClient client; | |
5 | ||
6 | ThreadClientoReceive(SocketClient c) { | |
7 | client = c; | |
8 | } | |
9 | ||
10 | public void run() { | |
11 | try { | |
12 | boolean end = false; | |
13 | //FIXME: not exiting properly randomly from that loop! | |
14 | while (!end) { | |
15 | Message roMsg = client.receiveoMsg(); | |
16 | if (roMsg.getTexte().equals(".")) { | |
6b300998 | 17 | end = true; |
c4aaaeca JB |
18 | } |
19 | System.out.println(Thread.currentThread().getName() + " a recu " + roMsg); | |
20 | } | |
21 | } | |
22 | catch (IOException e) { | |
23 | System.err.println("IOException: " + e); | |
24 | e.printStackTrace(); | |
25 | } | |
26 | catch (ClassNotFoundException e) { | |
27 | System.err.println("ClassNotFoundException: " + e); | |
28 | e.printStackTrace(); | |
29 | } | |
30 | } | |
31 | } |