codec

package
v0.0.0-...-2e4f182 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SizeLen = 4

SizeLen 数据包长度帧的长度

Variables

View Source
var (
	// MaxMessageSize 客户端消息最大长度,默认64KB
	MaxMessageSize = 64 * 1024
)

Functions

func PutMessage

func PutMessage(msg *Message)

PutMessage 把Message实例放回对象池

func ReadMessage

func ReadMessage(r io.Reader, msg *Message) error

ReadMessage 读消息

func SendBytes

func SendBytes(data []byte, sender func([]byte) error) error

SendBytes 发送字节流

func SendReply

func SendReply(reply *nh.Reply, sender func([]byte) error) error

SendReply 发送响应

Types

type Message

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

Message 网络消息

func GetMessage

func GetMessage() *Message

GetMessage 从对象池内获取Message实例

func (Message) Bytes

func (msg Message) Bytes() []byte

Bytes 消息数据

func (Message) Len

func (msg Message) Len() int

Len 数据长度

func (*Message) Reset

func (msg *Message) Reset()

Reset 重置

Jump to

Keyboard shortcuts

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