Receivers

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDynamicSpliceSymbol added in v1.1.1

func NewDynamicSpliceSymbol(startSymbol byte, finishSymbol byte) netInterface.IReceiver

实例化

Types

type DynamicReceiver

type DynamicReceiver struct {
	Receivers   []netInterface.IReceiver //分包器集合
	ReceiverLen int                      //分包器个数
	IsPackStart bool                     //是否开始分包
	IsSingle    bool                     //是否只有一个分包算法
	// contains filtered or unexported fields
}

策略分包器

func NewDynamicReceiver

func NewDynamicReceiver() *DynamicReceiver

策略分包器

func (*DynamicReceiver) Receiver

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

分包处理

type DynamicSpliceSymbol added in v1.1.1

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

单字节策略

func (*DynamicSpliceSymbol) IsMeHandle added in v1.1.1

func (d *DynamicSpliceSymbol) IsMeHandle(conn netInterface.IConnection, buffer []byte) bool

是否我处理

func (*DynamicSpliceSymbol) Receiver added in v1.1.1

func (d *DynamicSpliceSymbol) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int, bool)

分包处理[处理一包后跳出]

type SpliceSymbolReceiver

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

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

func NewSpliceSymbolReceiver

func NewSpliceSymbolReceiver(startSymbol byte, finishSymbol byte) *SpliceSymbolReceiver

按照开始结束符来粘包

func (*SpliceSymbolReceiver) Receiver

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

分包逻辑

Jump to

Keyboard shortcuts

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