reactor

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeSync = iota
	ModeAsync
)

Variables

View Source
var (
	TimeoutErr = errors.New("timeout")
)

Functions

This section is empty.

Types

type Stream

type Stream struct {
	io.Reader
	io.Writer
	io.Closer
	// contains filtered or unexported fields
}

func CreateWithRWC

func CreateWithRWC(r io.Reader, w io.Writer, c io.Closer) *Stream

func New

func New(r io.ReadWriteCloser) *Stream

func (*Stream) Close

func (s *Stream) Close()

func (*Stream) DataListener

func (s *Stream) DataListener(listener func([]byte))

func (*Stream) OnConnectionLost added in v0.0.19

func (s *Stream) OnConnectionLost(listener func(reason error))

func (*Stream) ReadSync

func (s *Stream) ReadSync(p []byte, timeout time.Duration) (err error)

阻塞读取 p 数据 timeout 超时间隔 err 超时返回

func (*Stream) Write

func (s *Stream) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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