tcpservice

package
v0.0.0-...-ff803ae Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxNodeId = 1<<10 - 1 //Uint10
	MaxSeed   = 1<<22 - 1 //MaxUint24
)
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

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表示数据
	//MsgProcessor processor.IProcessor
	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
	// 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) NewClient

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

func (*TcpService) OnInit

func (tcpService *TcpService) OnInit() error

func (*TcpService) SendMsg

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

func (*TcpService) SendRawMsg

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

func (*TcpService) SetProcessor

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

func (*TcpService) TcpEventHandler

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

Jump to

Keyboard shortcuts

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