Documentation ¶
Index ¶
- Constants
- func GetNodeId(agentId uint64) int
- type Client
- type TcpPack
- type TcpPackType
- type TcpService
- func (tcpService *TcpService) Close(clientId uint64)
- func (tcpService *TcpService) GetClientIp(clientid uint64) string
- func (tcpService *TcpService) GetConnNum() int
- func (server *TcpService) GetNetMempool() network.INetMempool
- func (tcpService *TcpService) NewClient(conn *network.TCPConn) network.Agent
- func (tcpService *TcpService) OnInit() error
- func (server *TcpService) ReleaseNetMem(byteBuff []byte)
- func (tcpService *TcpService) SendMsg(clientId uint64, msg interface{}) error
- func (tcpService *TcpService) SendRawData(clientId uint64, data []byte) error
- func (tcpService *TcpService) SendRawMsg(clientId uint64, msg []byte) error
- func (server *TcpService) SetNetMempool(mempool network.INetMempool)
- func (tcpService *TcpService) SetProcessor(process processor.IProcessor, handler event.IEventHandler)
- func (tcpService *TcpService) TcpEventHandler(ev event.IEvent)
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
View Source
const Default_ReadDeadline = 180 //30s
View Source
const Default_WriteDeadline = 180 //30s
Variables ¶
This section is empty.
Functions ¶
Types ¶
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)
Click to show internal directories.
Click to hide internal directories.