LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package net | 5 package net |
6 | 6 |
7 import ( | 7 import ( |
8 "io" | 8 "io" |
9 "os" | 9 "os" |
10 "syscall" | 10 "syscall" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // CloseWrite shuts down the writing side of the TCP connection. | 38 // CloseWrite shuts down the writing side of the TCP connection. |
39 // Most callers should just use Close. | 39 // Most callers should just use Close. |
40 func (c *TCPConn) CloseWrite() error { | 40 func (c *TCPConn) CloseWrite() error { |
41 if !c.ok() { | 41 if !c.ok() { |
42 return syscall.EINVAL | 42 return syscall.EINVAL |
43 } | 43 } |
44 return c.fd.closeWrite() | 44 return c.fd.closeWrite() |
45 } | 45 } |
46 | 46 |
47 // SetLinger sets the behavior of Close() on a connection which still | 47 // SetLinger sets the behavior of Close on a connection which still |
48 // has data waiting to be sent or to be acknowledged. | 48 // has data waiting to be sent or to be acknowledged. |
49 // | 49 // |
50 // If sec < 0 (the default), Close returns immediately and the | 50 // If sec < 0 (the default), the operating system finishes sending the |
51 // operating system finishes sending the data in the background. | 51 // data in the background. |
52 // | 52 // |
53 // If sec == 0, Close returns immediately and the operating system | 53 // If sec == 0, the operating system discards any unsent or |
54 // discards any unsent or unacknowledged data. | 54 // unacknowledged data. |
55 // | 55 // |
56 // If sec > 0, Close blocks for at most sec seconds waiting for data | 56 // If sec > 0, the data is sent in the background as with sec < 0. On |
57 // to be sent and acknowledged. | 57 // some operating systems after sec seconds have elapsed any remaining |
| 58 // unsent data may be discarded. |
58 func (c *TCPConn) SetLinger(sec int) error { | 59 func (c *TCPConn) SetLinger(sec int) error { |
59 return syscall.EPLAN9 | 60 return syscall.EPLAN9 |
60 } | 61 } |
61 | 62 |
62 // SetKeepAlive sets whether the operating system should send | 63 // SetKeepAlive sets whether the operating system should send |
63 // keepalive messages on the connection. | 64 // keepalive messages on the connection. |
64 func (c *TCPConn) SetKeepAlive(keepalive bool) error { | 65 func (c *TCPConn) SetKeepAlive(keepalive bool) error { |
65 if !c.ok() { | 66 if !c.ok() { |
66 return syscall.EPLAN9 | 67 return syscall.EPLAN9 |
67 } | 68 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 189 } |
189 if laddr == nil { | 190 if laddr == nil { |
190 laddr = &TCPAddr{} | 191 laddr = &TCPAddr{} |
191 } | 192 } |
192 fd, err := listenPlan9(net, laddr) | 193 fd, err := listenPlan9(net, laddr) |
193 if err != nil { | 194 if err != nil { |
194 return nil, err | 195 return nil, err |
195 } | 196 } |
196 return &TCPListener{fd}, nil | 197 return &TCPListener{fd}, nil |
197 } | 198 } |
LEFT | RIGHT |