TD2: Fix some comments.
[TD_SR.git] / TD2 / IHM / SocketClient.java
index 92c7412113f3b2107c0edef45823691430405cd6..daa77ee1bef7a54608a7ad44ead683d4f45bad9c 100644 (file)
@@ -37,6 +37,20 @@ public class SocketClient {
         }
     }
 
+    public SocketClient(boolean withoStream) {
+        // établie une connexion au serveur par un appel
+        // à connexionServeur()
+        attributesInit();
+        try {
+            connexionServeur("localhost", 5000, withoStream);
+        }
+        catch (IOException e) {
+            System.err.println("IOException: " + e);
+            e.printStackTrace();
+            closeRWIO();
+        }
+    }
+
     private void connexionServeur(String adresseIPServeur, int portServeur, boolean hasoStream) throws IOException {
         // créer un objet socket lié au socket serveur et l'affecte à sock
         // puis établie les chaînages de flot nécessaires
@@ -81,7 +95,7 @@ public class SocketClient {
 
     /**
      * Send an object message on the opened client socket
-     * @param msg a string containing the message to send
+     * @param oMsg an object containing the message to send
      */
     public void sendoMsg(Message oMsg) throws IOException {
         oEcriture.writeObject(oMsg);
@@ -101,7 +115,7 @@ public class SocketClient {
 
     /**
      * Receive an object message sent on the opened client socket
-     * @return a string containing the received message
+     * @return an object containing the received message
      */
     public Message receiveoMsg() throws IOException, ClassNotFoundException {
         return (Message)oLecture.readObject();