From 0935ac594ce308402d9ef0d9a5ffe60edf817095 Mon Sep 17 00:00:00 2001 From: Haibin Liu Date: Sat, 24 Oct 2015 00:13:48 +0800 Subject: [PATCH] Update 08.1 en --- en/08.1.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/08.1.md b/en/08.1.md index ed6dbb5d..8640efed 100644 --- a/en/08.1.md +++ b/en/08.1.md @@ -42,7 +42,7 @@ The `net` package in Go provides many types, functions and methods for network p type IP []byte -Functions `ParseIP(s string) IP` is for converting an IP from the IPv4 format into IPv6: +Function `ParseIP(s string) IP` is to convert the IPv4 or IPv6 format to an IP: package main import ( @@ -297,7 +297,7 @@ Some of you may be thinking the following: this server does not do anything mean } } -In this example, we use `conn.Read()` to constantly read client requests. We cannot close the connection because clients may issue more than one request. Due to the timeout we set using `conn.SetReadDeadline()`, the connection closes automatically when a client has not sent a request within our allotted time period. When then expiry time has elapsed, our program breaks from the `for` loop. Notice that `request` needs to be created with a max size limitation in order to prevent flood attacks. FInally, we clean the `request` array after processing every request, since `conn.Read()` appends new content to the array instead of rewriting it. +In this example, we use `conn.Read()` to constantly read client requests. We cannot close the connection because clients may issue more than one request. Due to the timeout we set using `conn.SetReadDeadline()`, the connection closes automatically when a client has not sent a request within our allotted time period. When then expiry time has elapsed, our program breaks from the `for` loop. Notice that `request` needs to be created with a max size limitation in order to prevent flood attacks. Finally, we clean the `request` array after processing every request, since `conn.Read()` appends new content to the array instead of rewriting it. ### Controlling TCP connections