tcp

package
v0.0.0-...-730ab85 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) AddRouter

func (c *Client) AddRouter(msgId byte, router common.IRouter)

func (*Client) Close

func (c *Client) Close()

func (*Client) Connect

func (c *Client) Connect()

func (*Client) GetConnect

func (c *Client) GetConnect() *common.Connection

func (*Client) SendBuffMsg

func (c *Client) SendBuffMsg(msgId byte, data []byte) error

func (*Client) SendMsg

func (c *Client) SendMsg(msgId byte, data []byte) error

type DataPack

type DataPack struct {
	MaxPacketSize uint32
}

func (*DataPack) GetHeadLen

func (dp *DataPack) GetHeadLen() uint32

func (*DataPack) Pack

func (dp *DataPack) Pack(msg *common.Message) ([]byte, error)

func (*DataPack) Unpack

func (dp *DataPack) Unpack(binaryData []byte) (*common.Message, error)

type Server

type Server struct {
	OnConnStart func(conn *common.Connection)
	OnConnStop  func(conn *common.Connection)
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) AddRouter

func (s *Server) AddRouter(msgId byte, router common.IRouter)

func (*Server) GetConnMgr

func (s *Server) GetConnMgr() *common.ConnManager

func (*Server) SetOnConnStart

func (s *Server) SetOnConnStart(hookFunc func(*common.Connection))

func (*Server) SetOnConnStop

func (s *Server) SetOnConnStop(hookFunc func(*common.Connection))

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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