Source

GoTalk / client.go

Full commit
package main

import (
        "fmt"
        "os"
        "net
        "bufio"
        "strings"
)

func main() {
    // Open connection
    conn, err := net.Dial("tcp", "localhost:50000")
    if err != nil {
        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))
    }
}