There was an error while loading. Please reload this page.
2 parents 1dfcbc6 + 8c8af14 commit e5d0586Copy full SHA for e5d0586
ebook/08.1.md
@@ -256,7 +256,7 @@ Go语言中通过net包中的`DialTCP`函数来建立一个TCP连接,并返回
256
func handleClient(conn net.Conn) {
257
conn.SetReadDeadline(time.Now().Add(2 * time.Minute)) // set 2 minutes timeout
258
request := make([]byte, 128) // set maxium request length to 128KB to prevent flood attack
259
-
+defer conn.Close() // close connection before exit
260
for {
261
read_len, err := conn.Read(request)
262
0 commit comments