TD2: code cleanup in the client part.
[TD_SR.git] / TD2 / client / Main.java
CommitLineData
18eb400b
JB
1import java.io.*;
2
3
4public class Main {
5
58312685
JB
6 /**
7 * Main for testing ClientSimplifie
8 */
2c648f75
JB
9 private static void main1() {
10 SocketClient client = new SocketClient();
11
12 try {
58312685 13 client.sendMsg("Line1");
2c648f75
JB
14 String msg = client.receiveMsg();
15 System.out.println(msg);
16 }
17 catch (Exception e) {
18 System.err.println("Exception: " + e);
19 }
20 finally {
21 client.closeRWIO();
22 }
23 }
18eb400b 24
18eb400b 25
2c648f75 26 public static void main (String[] args) {
58312685 27 SocketClient client = new SocketClient();
18eb400b 28
58312685 29 // try {
2c648f75 30 ThreadClientSend thCS = new ThreadClientSend(client);
58312685
JB
31 //FIXME: Implement a loop based on user input to set dynamically the message to sent.
32 //for (int i = 0; i < 10; i++) {
33 // thCS.setMsg("Line" + i);
34 //}
35 thCS.setMsg("Line1");
2c648f75
JB
36 Thread thS = new Thread(thCS);
37 Thread thR = new Thread(new ThreadClientReceive(client));
38 thS.setName("thS");
39 thS.start();
40 thR.setName("thR");
41 thR.start();
58312685
JB
42 // }
43 // catch (Exception e) {
44 // System.err.println("Exception: " + e);
45 // }
46 // finally {
47 // client.closeRWIO();
48 // }
18eb400b
JB
49
50 }
51
52}