103
107
SetWriteDeadline(t time.Time) error
114
func (c *conn) ok() bool { return c != nil && c.fd != nil }
116
// Implementation of the Conn interface.
118
// Read implements the Conn Read method.
119
func (c *conn) Read(b []byte) (int, error) {
121
return 0, syscall.EINVAL
126
// Write implements the Conn Write method.
127
func (c *conn) Write(b []byte) (int, error) {
129
return 0, syscall.EINVAL
134
// Close closes the connection.
135
func (c *conn) Close() error {
137
return syscall.EINVAL
142
// LocalAddr returns the local network address.
143
func (c *conn) LocalAddr() Addr {
150
// RemoteAddr returns the remote network address.
151
func (c *conn) RemoteAddr() Addr {
158
// SetDeadline implements the Conn SetDeadline method.
159
func (c *conn) SetDeadline(t time.Time) error {
161
return syscall.EINVAL
163
return setDeadline(c.fd, t)
166
// SetReadDeadline implements the Conn SetReadDeadline method.
167
func (c *conn) SetReadDeadline(t time.Time) error {
169
return syscall.EINVAL
171
return setReadDeadline(c.fd, t)
174
// SetWriteDeadline implements the Conn SetWriteDeadline method.
175
func (c *conn) SetWriteDeadline(t time.Time) error {
177
return syscall.EINVAL
179
return setWriteDeadline(c.fd, t)
182
// SetReadBuffer sets the size of the operating system's
183
// receive buffer associated with the connection.
184
func (c *conn) SetReadBuffer(bytes int) error {
186
return syscall.EINVAL
188
return setReadBuffer(c.fd, bytes)
191
// SetWriteBuffer sets the size of the operating system's
192
// transmit buffer associated with the connection.
193
func (c *conn) SetWriteBuffer(bytes int) error {
195
return syscall.EINVAL
197
return setWriteBuffer(c.fd, bytes)
200
// File sets the underlying os.File to blocking mode and returns a copy.
201
// It is the caller's responsibility to close f when finished.
202
// Closing c does not affect f, and closing f does not affect c.
204
// The returned os.File's file descriptor is different from the connection's.
205
// Attempting to change properties of the original using this duplicate
206
// may or may not have the desired effect.
207
func (c *conn) File() (f *os.File, err error) { return c.fd.dup() }
106
209
// An Error represents a network error.
107
210
type Error interface {
174
277
var errMissingAddress = errors.New("missing address")
279
// OpError is the error type usually returned by functions in the net
280
// package. It describes the operation, network type, and address of
176
282
type OpError struct {
283
// Op is the operation which caused the error, such as
284
// "read" or "write".
287
// Net is the network type on which this error occurred,
288
// such as "tcp" or "udp6".
291
// Addr is the network address on which this error occurred.
294
// Err is the error that occurred during the operation.
183
298
func (e *OpError) Error() string {
263
382
func (e *DNSConfigError) Timeout() bool { return false }
264
383
func (e *DNSConfigError) Temporary() bool { return false }
385
type writerOnly struct {
389
// Fallback implementation of io.ReaderFrom's ReadFrom, when sendfile isn't
391
func genericReadFrom(w io.Writer, r io.Reader) (n int64, err error) {
392
// Use wrapper to hide existing r.ReadFrom from io.Copy.
393
return io.Copy(writerOnly{w}, r)
396
// deadline is an atomically-accessed number of nanoseconds since 1970
397
// or 0, if no deadline is set.
398
type deadline struct {
403
func (d *deadline) expired() bool {
405
return t > 0 && time.Now().UnixNano() >= t
408
func (d *deadline) value() (v int64) {
415
func (d *deadline) set(v int64) {
421
func (d *deadline) setTime(t time.Time) {