| 1 | import java.io.*; |
| 2 | |
| 3 | |
| 4 | public class Main { |
| 5 | |
| 6 | public static void main(String[] args) { |
| 7 | SocketClient client = null; |
| 8 | Thread thS = null; |
| 9 | Thread thR = null; |
| 10 | IHM clientIHM = null; |
| 11 | |
| 12 | try { |
| 13 | clientIHM = new IHM(); |
| 14 | clientIHM.go(); |
| 15 | client = new SocketClient(); |
| 16 | thS = new Thread(new ThreadIHMSend(client, clientIHM)); |
| 17 | thR = new Thread(new ThreadIHMReceive(client, clientIHM)); |
| 18 | thS.setName("thS"); |
| 19 | thS.start(); |
| 20 | thR.setName("thR"); |
| 21 | thR.start(); |
| 22 | } |
| 23 | catch (Exception e) { |
| 24 | System.err.println("Exception : " + e); |
| 25 | e.printStackTrace(); |
| 26 | } |
| 27 | finally { |
| 28 | try { |
| 29 | thS.join(); |
| 30 | thR.join(); |
| 31 | } |
| 32 | catch (InterruptedException e) { |
| 33 | System.err.println("InterruptedException: " + e); |
| 34 | e.printStackTrace(); |
| 35 | } |
| 36 | client.closeRWIO(); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | } |