Receivers

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicReceiver

type DynamicReceiver struct {
	Receivers   []netInterface.IReceiver //分包器集合
	ReceiverLen int                      //分包器个数
	IsPackStart bool                     //是否开始分包
	IsSingle    bool                     //是否只有一个分包算法
	HDataCache  bool                     //是否启用处理数据缓存优化[注意:启用后SetOnReceiveCompleted 处理方法使用协程会导致数据错乱]
	BytesCache  *bytes.Buffer            //分包缓存:每个连接对应一个分包缓存
	OnReceive   func(data []byte)        //分包完整包回调
	// contains filtered or unexported fields
}

DynamicReceiver 策略分包器

func (*DynamicReceiver) Receiver

func (d *DynamicReceiver) Receiver(conn netInterface.IConnection, buffer []byte) (err error)

Receiver 分包处理

type JT1078Receiver added in v1.5.5

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

JT1078分包器

func NewJT1078Receiver added in v1.5.5

func NewJT1078Receiver(startBf []byte) *JT1078Receiver

按照开始结束符来粘包

func (*JT1078Receiver) CanHandle added in v1.5.6

func (j *JT1078Receiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool

是否我处理

func (*JT1078Receiver) GetHeadLen added in v1.5.6

func (j *JT1078Receiver) GetHeadLen() int

包头必须要够长度

func (*JT1078Receiver) Receiver added in v1.5.5

func (j *JT1078Receiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)

分包逻辑

type SpliceSymbolReceiver

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

/ 按照开始结束符来粘包(单字节版)

func NewSpliceSymbolReceiver

func NewSpliceSymbolReceiver(startSymbol byte, finishSymbol byte) *SpliceSymbolReceiver

按照开始结束符来粘包

func (*SpliceSymbolReceiver) CanHandle added in v1.5.6

func (s *SpliceSymbolReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool

是否能处理

func (*SpliceSymbolReceiver) GetHeadLen added in v1.5.6

func (s *SpliceSymbolReceiver) GetHeadLen() int

包头必须要的长度

func (*SpliceSymbolReceiver) Receiver

func (s *SpliceSymbolReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)

分包逻辑

Jump to

Keyboard shortcuts

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