From 26b2eb40fc2ccafc7f451aecfb9d244107ec933b Mon Sep 17 00:00:00 2001 From: better0332 Date: Thu, 25 Apr 2013 18:06:33 +0800 Subject: [PATCH] =?UTF-8?q?DialTimeout=E5=9C=A8net=E5=BA=93=E4=B8=AD?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E6=B2=A1=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ebook/08.1.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ebook/08.1.md b/ebook/08.1.md index 153de3f5..cd0c9577 100644 --- a/ebook/08.1.md +++ b/ebook/08.1.md @@ -229,7 +229,8 @@ Go语言中通过net包中的`DialTCP`函数来建立一个TCP连接,并返回 ### 控制TCP连接 TCP有很多连接控制函数,我们平常用到比较多的有如下几个函数: - func (c *TCPConn) SetTimeout(nsec int64) os.Error + #func (c *TCPConn) SetTimeout(nsec int64) os.Error + func DialTimeout(net, addr string, timeout time.Duration) (Conn, error) func (c *TCPConn) SetKeepAlive(keepalive bool) os.Error 第一个函数用来设置连接的超时时间,客户端和服务器端都适用,当超过设置的时间时该连接就会失效。