transceiver

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2017 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deadline

type Deadline interface {
	SetReadDeadline(time.Time) error
	SetWriteDeadline(time.Time) error
}

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

Stream is a buffered I/O channel.

func NewStream

func NewStream(channel io.ReadWriteCloser) *Stream

NewStream returns a new buffered I/O channel. channel is an underlying I/O channel that implements io.ReadWriteCloser.

func (*Stream) Close

func (r *Stream) Close() error

Close is a wrapper function of net.Conn.Close().

func (*Stream) Peek

func (r *Stream) Peek(n int) (p []byte, err error)

Peek is a wrapper function of bufio.Reader.Peek().

func (*Stream) Read

func (r *Stream) Read(p []byte) (n int, err error)

Read is a wrapper function of bufio.Reader.Read().

func (*Stream) ReadN

func (r *Stream) ReadN(n int) (p []byte, err error)

ReadN reads exactly n bytes from this socket. It returns non-nil error if len(p) < n, and the data, whose length is len(p) bytes long, still remains in the socket buffer.

func (*Stream) SetReadTimeout

func (r *Stream) SetReadTimeout(t time.Duration)

SetReadTimeout sets read timeout of the underlying I/O channel if the channel implements Deadline interface.

func (*Stream) SetWriteTimeout

func (r *Stream) SetWriteTimeout(t time.Duration)

SetWriteTimeout sets write timeout of the underlying I/O channel if the channel implements Deadline interface.

func (*Stream) Write

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

Write is a wrapper function of net.Conn.Write().

type Transceiver

type Transceiver struct {
	// contains filtered or unexported fields
}

func NewTransceiver

func NewTransceiver(stream *Stream, handler Handler) *Transceiver

func (*Transceiver) Close

func (r *Transceiver) Close() error

func (*Transceiver) Run

func (r *Transceiver) Run(ctx context.Context) error

func (*Transceiver) Version

func (r *Transceiver) Version() (negotiated bool, version uint8)

func (*Transceiver) Write

func (r *Transceiver) Write(msg encoding.BinaryMarshaler) error

type WriteCloser

type WriteCloser interface {
	Writer
	Close() error
}

type Writer

type Writer interface {
	Write(msg encoding.BinaryMarshaler) error
}

Jump to

Keyboard shortcuts

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