1. Cédric Bonhomme
  2. GoTalk

Commits

Cédric Bonhomme  committed 9b3693f

test version of the go client

  • Participants
  • Parent commits 2dff54d
  • Branches default

Comments (0)

Files changed (1)

File client.go

View file
  • Ignore whitespace
         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))
+    }
 }