Receivers

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 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) netConn.IReceiver

实例化

Types

type DynamicReceiver

type DynamicReceiver struct {
	CurrentReceiver netConn.IReceiver   //当前分包器
	Receivers       []netConn.IReceiver //分包器集合
	IsPackStart     bool                //是否开始分包
	IsSingle        bool                //是否只有一个分包算法
}

策略分包器

func NewDynamicReceiver

func NewDynamicReceiver() *DynamicReceiver

策略分包器

func (*DynamicReceiver) Receiver

func (d *DynamicReceiver) Receiver(conn netConn.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 netConn.IConnection, buffer []byte) bool

是否我处理

func (*DynamicSpliceSymbol) Receiver added in v1.1.1

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

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

type SpliceSymbolReceiver

type SpliceSymbolReceiver struct {
	StartSymbol  byte
	FinishSymbol byte
}

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

func NewSpliceSymbolReceiver

func NewSpliceSymbolReceiver(startSymbol byte, finishSymbol byte) *SpliceSymbolReceiver

按照开始结束符来粘包

func (*SpliceSymbolReceiver) Receiver

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

分包逻辑

Jump to

Keyboard shortcuts

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