tcpservice

package
v1.18.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxNodeId = 1<<14 - 1 //最大值 16383
	MaxSeed   = 1<<19 - 1 //最大值 524287
	MaxTime   = 1<<31 - 1 //最大值 2147483647
)
View Source
const Default_LittleEndian = false
View Source
const Default_MaxConnNum = 3000
View Source
const Default_MaxMsgLen = 65535
View Source
const Default_MinMsgLen = 2
View Source
const Default_PendingWriteNum = 10000
View Source
const Default_ReadDeadline = 180 //30s
View Source
const Default_WriteDeadline = 180 //30s

Variables

This section is empty.

Functions

func GetNodeId

func GetNodeId(agentId uint64) int

Types

type Client

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

func (*Client) GetId

func (slf *Client) GetId() uint64

func (*Client) OnClose

func (slf *Client) OnClose()

func (*Client) Run

func (slf *Client) Run()

type TcpPack

type TcpPack struct {
	Type     TcpPackType //0表示连接 1表示断开 2表示数据
	ClientId uint64
	Data     interface{}
}

type TcpPackType

type TcpPackType int8
const (
	TPT_Connected    TcpPackType = 0
	TPT_DisConnected TcpPackType = 1
	TPT_Pack         TcpPackType = 2
	TPT_UnknownPack  TcpPackType = 3
)

type TcpService

type TcpService struct {
	service.Service

	ReadDeadline  time.Duration
	WriteDeadline time.Duration
	// contains filtered or unexported fields
}

func (*TcpService) Close

func (tcpService *TcpService) Close(clientId uint64)

func (*TcpService) GetClientIp

func (tcpService *TcpService) GetClientIp(clientid uint64) string

func (*TcpService) GetConnNum

func (tcpService *TcpService) GetConnNum() int

func (*TcpService) GetNetMempool

func (server *TcpService) GetNetMempool() network.INetMempool

func (*TcpService) NewClient

func (tcpService *TcpService) NewClient(conn *network.TCPConn) network.Agent

func (*TcpService) OnInit

func (tcpService *TcpService) OnInit() error

func (*TcpService) ReleaseNetMem

func (server *TcpService) ReleaseNetMem(byteBuff []byte)

func (*TcpService) SendMsg

func (tcpService *TcpService) SendMsg(clientId uint64, msg interface{}) error

func (*TcpService) SendRawData

func (tcpService *TcpService) SendRawData(clientId uint64, data []byte) error

func (*TcpService) SendRawMsg

func (tcpService *TcpService) SendRawMsg(clientId uint64, msg []byte) error

func (*TcpService) SetNetMempool

func (server *TcpService) SetNetMempool(mempool network.INetMempool)

func (*TcpService) SetProcessor

func (tcpService *TcpService) SetProcessor(process processor.IProcessor, handler event.IEventHandler)

func (*TcpService) TcpEventHandler

func (tcpService *TcpService) TcpEventHandler(ev event.IEvent)

Jump to

Keyboard shortcuts

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