X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TD2%2Fclient%2FMain.java;h=bd02ad4562eaf4a51a4ec7d86881b20464612969;hb=1a8b0826b5021061a361550b8a83cde7c25955cb;hp=00d8924007536f9abc71d99c88d3fccdccece996;hpb=b9a33c97f77a1eae45b91426ca8061e18f163d4e;p=TD_SR.git diff --git a/TD2/client/Main.java b/TD2/client/Main.java index 00d8924..bd02ad4 100644 --- a/TD2/client/Main.java +++ b/TD2/client/Main.java @@ -39,7 +39,10 @@ public class Main { } } - public static void main (String[] args) { + /** + * main for text based message broadcasting + */ + public static void main2() { SocketClient client = null; Thread thS = null; Thread thR = null; @@ -69,4 +72,34 @@ public class Main { } } + public static void main(String[] args) { + SocketClient client = null; + Thread thS = null; + Thread thR = null; + + try { + client = new SocketClient(true); + thS = new Thread(new ThreadClientoSend(client)); + thR = new Thread(new ThreadClientoReceive(client)); + thS.setName("thoS"); + thS.start(); + thR.setName("thoR"); + thR.start(); + } + catch (Exception e) { + System.err.println("Exception: " + e); + } + finally { + try { + thS.join(); + thR.join(); + } + catch (InterruptedException e) { + System.err.println("InterruptedException: " + e); + e.printStackTrace(); + } + client.closeRWIO(); + } + } + }