packet

package
v0.0.0-...-9682c69 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w io.Writer, data []byte) error

func WriteTo

func WriteTo(w io.Writer, p *Packet) (int64, error)

WriteTo write package to w Please goto method ReadFrom to see protocal details

Types

type BytesPool

type BytesPool interface {
	Get(len int) []byte
	Put(p []byte)
}
var Pool BytesPool

func NewBytesPool

func NewBytesPool(size int) BytesPool

type Packet

type Packet struct {
	Len  int
	Data []byte
}

func New

func New() *Packet

func ReadFrom

func ReadFrom(r io.Reader, reuse *Packet) (p *Packet, err error)

ReadFrom read packet from r BigEndian(uint16(len)) + data len = len(data)

func (*Packet) Reset

func (p *Packet) Reset()

Reset reuse Packet

Jump to

Keyboard shortcuts

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