TcpServer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IHandler

type IHandler interface {
	GetHeaderLength() (int, error)           // 最小包长度检查
	InvalidHeader(data []byte) (bool, error) // 是否为非法报文:通过检查报文头部,这些协议中约定的起始标记,判定该报文是否为合法的报文
	GetPackLength(data []byte) (int, error)  // 包长度信息:从minPack数组中,取出报文长度信息
}

type INotify

type INotify interface {
	ChannelActive(conn net.Conn)              // 通知数据到达
	ChannelRead(conn net.Conn, data []byte)   // 通知数据到达
	ChannelClose(conn net.Conn)               // 通知连接关闭
	ExceptionCaught(conn net.Conn, err error) // 通知出现异常
}

type TcpServer

type TcpServer struct {
	Handler IHandler
	Notify  INotify
	Port    int
}

func (*TcpServer) StartTcpServer

func (e *TcpServer) StartTcpServer() error

Jump to

Keyboard shortcuts

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