nettimeout

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Conn wraps a net.Conn, and sets a deadline for every read and write operation.

func (*Conn) Read

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

func (*Conn) Write

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

type Listener

type Listener struct {
	*stoppableListener.StoppableListener
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Listener wraps a net.Listener, and gives a place to store the timeout parameters. On Accept, it will wrap the net.Conn with our own Conn for us.

func NewListener

func NewListener(port int, readTimeout, writeTimeout time.Duration) (*Listener, error)

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

func (*Listener) Stop

func (l *Listener) Stop()

Jump to

Keyboard shortcuts

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