+++ /dev/null
-import java.util.concurrent.ThreadLocalRandom;
-
-public class ThreadClientSend implements Runnable {
- private SocketClient client;
- private String msg = new String();
-
- ThreadClientSend(SocketClient c) {
- client = c;
- }
-
- /**
- * [setMsg description]
- * @param m [description]
- */
- public void setMsg(String m) {
- msg = m;
- }
-
- public void run() {
- while (true) {
- try {
- client.sendMsg(msg);
- System.out.println (Thread.currentThread().getName() + " a envoye " + msg);
- try {
- Thread.sleep(ThreadLocalRandom.current().nextInt(101));
- }
- catch (InterruptedException e) {
- System.err.println("InterruptedException: " + e);
- }
- }
- catch (Exception e) {
- System.err.println("Exception: " + e);
- }
- //finally {
- // client.closeRWIO();
- //}
- }
- }
-}