Commits

Cédric Bonhomme committed 9b3693f

test version of the go client

Comments (0)

Files changed (1)

         fmt.Println("Error", err.Error())
         return // terminate program
     }
+
+    inputReader := bufio.NewReader(os.Stdin)
+    fmt.Println("Your name:")
+    clientName, _ := inputReader.ReadString('\n')
+    trimmedClient := strings.Trim(clientName, "n")
+
+    for {
+        fmt.Println("What to send to the server? Type Q to quit.")
+        input, _ :=inputReader.ReadString('\n')
+        trimmedInput := strings.Trim(input, "\n")
+
+        if trimmedInput == "Q" {
+            return
+        }
+
+        _, err = con.Write([]byte(trimmedInput))
+    }
 }