network

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

network.go

tcpclient.go

Index

Constants

View Source
const (
	// for server mode
	ActionTypeForServer = uint8(1)
	// for client mode
	ActionTypeForClient = uint8(2)
)
View Source
const (
	KeepAlive = int64(30 * time.Second)
)

Variables

action work type default server

Functions

func BootServer

func BootServer() error

func GetActionManagerIns

func GetActionManagerIns() *actionManager

func QueueServiceIns

func QueueServiceIns() *queueService

func ServerLoginBack

func ServerLoginBack(cglm *proto.CG_LonginMessage, session *common.Session, roleId int64,
	retCode int8, errMsg string, queueIndex int32)

common login back if login not ok

func ServerLoginBackFail

func ServerLoginBackFail(cglm *proto.CG_LonginMessage, session *common.Session, retCode int8, errMsg string)

func TcpServerIns

func TcpServerIns() *tcpServer

Types

type Account

type Account struct {
	AccId     string
	AccName   string
	RoleId    int64
	AuthToken string
}

account info

type ActionHandler

type ActionHandler func(proto.ProtoMessage, interface{}) error

type HandleDecodeFunc

type HandleDecodeFunc func(*common.Session, *bufio.Reader) error

type HandleEncodeFunc

type HandleEncodeFunc func(*bufio.Writer, proto.ProtoMessage) error

type Service

type Service interface {
	Start() error
	Tick(delta int64) error
	Stop() error
}

type TcpClient

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

func NewTcpClient

func NewTcpClient(addr string, id uint64) (*TcpClient, error)

create a TcpCient call InitAccount call Start

func (*TcpClient) Close

func (client *TcpClient) Close() error

func (*TcpClient) FillAccount

func (client *TcpClient) FillAccount(roleId int64)

func (*TcpClient) Id

func (client *TcpClient) Id() uint64

func (*TcpClient) InitAccount

func (client *TcpClient) InitAccount(accId string, accName string)

func (*TcpClient) Start

func (client *TcpClient) Start() error

Jump to

Keyboard shortcuts

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