diff --git a/zh/08.1.md b/zh/08.1.md index 1e22a96e..fcf9f4c2 100644 --- a/zh/08.1.md +++ b/zh/08.1.md @@ -236,6 +236,7 @@ Go语言中通过net包中的`DialTCP`函数来建立一个TCP连接,并返回 "os" "time" "strconv" + "strings" ) func main() { @@ -267,7 +268,7 @@ Go语言中通过net包中的`DialTCP`函数来建立一个TCP连接,并返回 if read_len == 0 { break // connection already closed by client - } else if string(request) == "timestamp" { + } else if strings.TrimSpace(string(request[:read_len])) == "timestamp" { daytime := strconv.FormatInt(time.Now().Unix(), 10) conn.Write([]byte(daytime)) } else {