package main import ( "fmt" "net" "course/networkProgram/protocol" ) // socket_stick/client/os.args.go func main() { conn, err := net.Dial("tcp", "127.0.0.1:30000") if err != nil { fmt.Println("dial failed, err", err) return } defer conn.Close() for i := 0; i < 20; i++ { msg := `Hello, Hello. How are you?` b, err := proto.Encode(msg) if err != nil { fmt.Println("encode failed, err", err) } conn.Write(b) //time.Sleep(1 * time.Second) } }