- while (true) {
- try {
- msg = client.receiveMsg();
- System.out.println (Thread.currentThread().getName() + " a recu " + msg);
- try {
- Thread.sleep(ThreadLocalRandom.current().nextInt(101));
- }
- catch (InterruptedException e) {
- System.err.println("InterruptedException: " + e);
- }
- }
- catch (Exception e) {
- System.err.println("Exception: " + e);
+ try {
+ boolean end = false;
+ //FIXME: not exiting properly randomly from that loop!
+ while (!end) {
+ String rline = client.receiveMsg();
+ if (rline.equals(".")) {
+ end = true;
+ }
+ System.out.println(Thread.currentThread().getName() + " a recu " + rline);