repositories
/
TD_SR.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TD2: code cleanup in the client part.
[TD_SR.git]
/
TD2
/
client
/
Main.java
diff --git
a/TD2/Main.java
b/TD2/client/Main.java
similarity index 56%
rename from
TD2/Main.java
rename to
TD2/client/Main.java
index e7bd9638d3ce91f39700834fe09ee9679c407839..cc47bb7bd499c54bf3822ccc7fbaea975795df27 100644
(file)
--- a/
TD2/Main.java
+++ b/
TD2/client/Main.java
@@
-3,11
+3,14
@@
import java.io.*;
public class Main {
public class Main {
+ /**
+ * Main for testing ClientSimplifie
+ */
private static void main1() {
SocketClient client = new SocketClient();
try {
private static void main1() {
SocketClient client = new SocketClient();
try {
- client.sendMsg("Line
1 Line 2
");
+ client.sendMsg("Line
1
");
String msg = client.receiveMsg();
System.out.println(msg);
}
String msg = client.receiveMsg();
System.out.println(msg);
}
@@
-21,24
+24,28
@@
public class Main {
public static void main (String[] args) {
public static void main (String[] args) {
+ SocketClient client = new SocketClient();
- try {
- SocketClient client = new SocketClient();
+ // try {
ThreadClientSend thCS = new ThreadClientSend(client);
ThreadClientSend thCS = new ThreadClientSend(client);
- thCS.setMsg("Line1 Line2");
+ //FIXME: Implement a loop based on user input to set dynamically the message to sent.
+ //for (int i = 0; i < 10; i++) {
+ // thCS.setMsg("Line" + i);
+ //}
+ thCS.setMsg("Line1");
Thread thS = new Thread(thCS);
Thread thR = new Thread(new ThreadClientReceive(client));
thS.setName("thS");
thS.start();
thR.setName("thR");
thR.start();
Thread thS = new Thread(thCS);
Thread thR = new Thread(new ThreadClientReceive(client));
thS.setName("thS");
thS.start();
thR.setName("thR");
thR.start();
- }
- catch (Exception e) {
-
System.err.println("Exception: " + e);
- }
- finally {
-
client.closeRWIO();
- }
+
//
}
+
//
catch (Exception e) {
+
//
System.err.println("Exception: " + e);
+
//
}
+
//
finally {
+
//
client.closeRWIO();
+
//
}
}
}