Merge commit '8feb49dcda13f2a2107b16a97f2f9beb9aefca53' into ja

This commit is contained in:
Shin Kojima
2013-12-25 02:53:32 +09:00

View File

@@ -261,20 +261,12 @@ Go语言中通过net包中的`DialTCP`函数来建立一个TCP连接并返回
read_len, err := conn.Read(request)
if err != nil {
if err != io.EOF { // ignore EOF since client might send nothing for the moment
fmt.Println(err)
break
}
neterr, ok := err.(net.Error)
if ok && neterr.Timeout() {
fmt.Println(neterr)
break
}
fmt.Println(err)
break
}
if read_len == 0 {
continue
break // connection already closed by client
} else if string(request) == "timestamp" {
daytime := strconv.FormatInt(time.Now().Unix(), 10)
conn.Write([]byte(daytime))