Merge pull request #575 from lixuancn/patch-1

Fix Bug
This commit is contained in:
astaxie
2015-12-02 16:29:35 +08:00

View File

@@ -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 {