ex5
This commit is contained in:
22
src/Ex5/App.java
Normal file
22
src/Ex5/App.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package Ex5;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class App {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Server server = new Server(6666);
|
||||
Client client = new Client(new InetSocketAddress("localhost", 6666));
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Entrez des messages :");
|
||||
while (true) {
|
||||
String line = scanner.nextLine();
|
||||
System.out.println("[Client -> Server] " + line);
|
||||
client.sendMessage(line);
|
||||
|
||||
String response = client.readMessage();
|
||||
System.out.println("[Client <- Server] " + response);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user