net

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConnClosed error connection closed.
	ErrConnClosed = errors.New("connection is closed")
)

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Conn is a net.Conn self implement Add auto timeout setting.

func DialWithTimeout

func DialWithTimeout(addr string, dialTimeout, readTimeout, writeTimeout time.Duration) (c *Conn)

DialWithTimeout will create new auto timeout Conn

func NewConn

func NewConn(sock net.Conn, readTimeout, writeTimeout time.Duration) (c *Conn)

NewConn will create new Connection with given socket

func (*Conn) Close

func (c *Conn) Close() error

Close close conn.

func (*Conn) Dup

func (c *Conn) Dup() *Conn

Dup will re-dial to the given addr by using timeouts stored in itself.

func (*Conn) Read

func (c *Conn) Read(b []byte) (n int, err error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (n int, err error)

func (*Conn) Writev

func (c *Conn) Writev(buf *net.Buffers) (int64, error)

Writev impl the net.buffersWriter to support writev

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL