We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17fdc43 commit 8feb49dCopy full SHA for 8feb49d
ebook/08.1.md
@@ -261,20 +261,12 @@ Go语言中通过net包中的`DialTCP`函数来建立一个TCP连接,并返回
261
read_len, err := conn.Read(request)
262
263
if err != nil {
264
- if err != io.EOF { // ignore EOF since client might send nothing for the moment
265
- fmt.Println(err)
266
- break
267
- }
268
-
269
- neterr, ok := err.(net.Error)
270
- if ok && neterr.Timeout() {
271
- fmt.Println(neterr)
272
273
+ fmt.Println(err)
+ break
274
}
275
276
if read_len == 0 {
277
- continue
+ break // connection already closed by client
278
} else if string(request) == "timestamp" {
279
daytime := strconv.FormatInt(time.Now().Unix(), 10)
280
conn.Write([]byte(daytime))
0 commit comments