package main import "fmt" import "io/ioutil" import "net" import "os" func main() { addr := "localhost:9000" if len(os.Args) == 2 { addr = os.Args[1] } d, err := net.Dial("tcp", addr) if err != nil { panic(err) } defer d.Close() bs, err := ioutil.ReadAll(d) if err != nil { panic(err) } fmt.Println(string(bs)) }