netrpc

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: LGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const INVALID_peer2iptr = 0

INVALID_peer2iptr peerptr2me=INVALID_peer2iptr表示无效值,会被忽略

Variables

This section is empty.

Functions

func EnumCodeType

func EnumCodeType(pertype func(code uint16, ty reflect.Type)) int

func EnumNameType

func EnumNameType(pertype func(name string, ty reflect.Type)) int

func Marshal

func Marshal(pb Message) ([]byte, error)

func RegCliMsg

func RegCliMsg(msgdir uint8, regpb Message, msg_func func(cli2sock *CLI2sock, inpb Message))

func RegSvrMsg

func RegSvrMsg(msgdir uint8, regpb Message, msg_func func(svr2sock *SVR2sock, svr2ply *SVR2ply, inpb Message, memptr ...uint32))

func RegSvrRPC

func RegSvrRPC(msgdir uint8, regpb Message, rpc_func func(svr2sock *SVR2sock, svr2ply *SVR2ply, inpb Message, memptr ...uint32) (retcode int8, retpb Message))

RegSvrRPC 注册服务边Rpc相应函数

func RegisterType

func RegisterType(x Message)

RegisterType is called from generated code and maps from the fully qualified proto name to the type (pointer to struct) of the protocol buffer.

func SetMarshal

func SetMarshal(Marshal func(pb any) ([]byte, error))

func SetUnmarshal

func SetUnmarshal(Unmarshal func(buf []byte, pb any) error)

func Unmarshal

func Unmarshal(buf []byte, pb Message) error

Types

type CLI2base

type CLI2base struct {
	IOServer
	// contains filtered or unexported fields
}

CLI2base 服务器面向客户端边的基础对象

func NewCLI2base

func NewCLI2base(msgdir uint8, msgsvc CliMsgSvc, dbg, recv_concurr, cmdUseName bool,
	pktlen_size, recv_alive, send_alive int16, recv_interval int) *CLI2base

func (*CLI2base) CLI2base

func (this *CLI2base) CLI2base(msgdir uint8, msgsvc CliMsgSvc, dbg, recv_concurr, cmdUseName bool,
	pktlen_size, recv_alive, send_alive int16, recv_interval int) *CLI2base

func (*CLI2base) GetMsgDir added in v1.0.1

func (this *CLI2base) GetMsgDir() uint8

func (*CLI2base) NotRegMessge

func (this *CLI2base) NotRegMessge(cli2sock *CLI2sock, msg string, rpk *RPacket, parse func() Message)

func (*CLI2base) OnConnect

func (this *CLI2base) OnConnect(datasock *Datasock) bool

func (*CLI2base) OnConnected

func (this *CLI2base) OnConnected(datasock *Datasock)

func (*CLI2base) OnDecode

func (this *CLI2base) OnDecode(datasock *Datasock, cipher []byte)

func (*CLI2base) OnDisconnected

func (this *CLI2base) OnDisconnected(datasock *Datasock, disc_reason int)

func (*CLI2base) OnEncode

func (this *CLI2base) OnEncode(datasock *Datasock, text []byte)

func (*CLI2base) OnProcPack

func (this *CLI2base) OnProcPack(datasock *Datasock, rpk *RPacket)

func (*CLI2base) OnServeCall

func (this *CLI2base) OnServeCall(datasock *Datasock, rpk *RPacket) (retcode int8, retwpk *WPacket)

func (*CLI2base) SwitchRoutine

func (this *CLI2base) SwitchRoutine(cli2sock *CLI2sock, msg string, exefunc func())

type CLI2sock

type CLI2sock struct {
	zbsync.RWMutex
	*Datasock
	// contains filtered or unexported fields
}

CLI2sock 服务器面向客户端的socket

func (*CLI2sock) AiMain

func (this *CLI2sock) AiMain(fun_init, fun_idle func())

func (*CLI2sock) AiRunning

func (this *CLI2sock) AiRunning() bool

func (*CLI2sock) AiStop

func (this *CLI2sock) AiStop()

func (*CLI2sock) CLI2sock

func (this *CLI2sock) CLI2sock(datasock *Datasock, cli2base *CLI2base, pktcmd_size uint32) *CLI2sock

func (*CLI2sock) Disconnect

func (this *CLI2sock) Disconnect(discreason int, discfunc func()) int

func (*CLI2sock) GetMsgDir added in v1.0.1

func (this *CLI2sock) GetMsgDir() uint8

func (*CLI2sock) GetUPlevel

func (this *CLI2sock) GetUPlevel() any

func (*CLI2sock) IsConnected

func (this *CLI2sock) IsConnected() bool

func (*CLI2sock) PostTask

func (this *CLI2sock) PostTask(cancel_all bool, task func() (cancel_all bool, new_tmout_ms int32))

func (*CLI2sock) Send2Cli

func (this *CLI2sock) Send2Cli(wpk *WPacket) error

func (*CLI2sock) SendProt

func (this *CLI2sock) SendProt(pb Message) error

func (*CLI2sock) SendProt4Ret

func (this *CLI2sock) SendProt4Ret(pb Message, tmout_ms int32, canbreak bool, retmsg []string, callback func(retpb Message) (breakwait bool)) (retpb Message, err int8)

func (*CLI2sock) SetUPlevel

func (this *CLI2sock) SetUPlevel(uplevel any) (success bool)

func (*CLI2sock) Wait4Ret

func (this *CLI2sock) Wait4Ret(tmout_ms int32, canbreak bool, retmsg []string, callback func(retpb Message) (breakwait bool)) (retpb Message, err int8)

type CliMsgSvc

type CliMsgSvc interface {
	IOSerivce
	SwitchRoutine(cli2sock *CLI2sock, msg string, exefunc func())
	NotRegMessge(cli2sock *CLI2sock, msg string, rpk *RPacket, parse func() Message)
}

CliMsgSvc 客户端消息服务接口

type Datasock

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

Datasock 基础socket对象

func (*Datasock) AsynPack

func (this *Datasock) AsynPack(tmot_ms uint32, in_para *WPacket, acb func(retcode int8, retval *RPacket)) error

func (*Datasock) Datasock

func (this *Datasock) Datasock(tcpconn *net.TCPConn, this_lsn *LsnSocket, ios *IOServer) *Datasock

func (*Datasock) Disconnect

func (this *Datasock) Disconnect(discreason int, discfunc func()) int

func (*Datasock) GetCLI2sock

func (this *Datasock) GetCLI2sock() *CLI2sock

func (*Datasock) GetDiscError

func (this *Datasock) GetDiscError() error

func (*Datasock) GetEXSock

func (this *Datasock) GetEXSock() (curr_exsock any)

func (*Datasock) GetIOSvr

func (this *Datasock) GetIOSvr() *IOServer

func (*Datasock) GetLocalAddr

func (this *Datasock) GetLocalAddr() string

func (*Datasock) GetLocalIP

func (this *Datasock) GetLocalIP() string

func (*Datasock) GetLocalPort

func (this *Datasock) GetLocalPort() uint16

func (*Datasock) GetPeerAddr

func (this *Datasock) GetPeerAddr() string

func (*Datasock) GetPeerIP

func (this *Datasock) GetPeerIP() string

func (*Datasock) GetPeerPort

func (this *Datasock) GetPeerPort() uint16

func (*Datasock) GetSVR2sock

func (this *Datasock) GetSVR2sock() *SVR2sock

func (*Datasock) IsServer

func (this *Datasock) IsServer() bool

func (*Datasock) SendPack

func (this *Datasock) SendPack(wpk *WPacket) error

func (*Datasock) SetEXSock

func (this *Datasock) SetEXSock(new_exsock any) (prev_exsock any)

func (*Datasock) SetReadBuffer

func (this *Datasock) SetReadBuffer(bins int) error

func (*Datasock) SetWriteBuffer

func (this *Datasock) SetWriteBuffer(bins int) error

func (*Datasock) SyncPack

func (this *Datasock) SyncPack(tmot_ms uint32, in_para *WPacket) (retcode int8, retval *RPacket)

type GetMsgDir added in v1.0.1

type GetMsgDir interface {
	GetMsgDir() uint8
}

GetMsgDir 获取消息方向的接口

type IOSerivce

type IOSerivce interface {
	OnConnect(datasock *Datasock) bool
	OnConnected(datasock *Datasock)
	OnDisconnected(datasock *Datasock, disc_reason int)

	OnEncode(datasock *Datasock, text []byte)
	OnDecode(datasock *Datasock, cipher []byte)
	OnProcPack(datasock *Datasock, rpk *RPacket)
	OnServeCall(datasock *Datasock, rpk *RPacket) (retcode int8, retwpk *WPacket)
}

IOSerivce IO服务接口

type IOServer

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

IOServer 服务的运行class

func (*IOServer) CloseAllListen

func (this *IOServer) CloseAllListen()

CloseAllListen 关闭所有侦听端口

func (*IOServer) CloseListenByAddr

func (this *IOServer) CloseListenByAddr(ip string, port uint16) error

CloseListenByAddr 关闭侦听端口ByAddr

func (*IOServer) CloseListenByPtr

func (this *IOServer) CloseListenByPtr(lsn *LsnSocket) error

CloseListenByPtr 关闭侦听端口ByPtr

func (*IOServer) Connect

func (this *IOServer) Connect(ip string, port uint16, concted func(*Datasock)) (*Datasock, error)

func (*IOServer) Connect2

func (this *IOServer) Connect2(target string, concted func(*Datasock)) (*Datasock, error)

func (*IOServer) GetExitFlag

func (this *IOServer) GetExitFlag() *zbsync.Int32

func (*IOServer) GetRecvBytes

func (this *IOServer) GetRecvBytes() int64

func (*IOServer) GetRefCount

func (this *IOServer) GetRefCount() *zbsync.Int32

func (*IOServer) GetSendBytes

func (this *IOServer) GetSendBytes() int64

func (*IOServer) GetSockNum

func (this *IOServer) GetSockNum() int

func (*IOServer) IOServer

func (this *IOServer) IOServer(iosvc IOSerivce, dbg, recv_concurr, sendblock_kick bool, pktcombin zbrun.Runner,
	recvout_alive int16, sendout_alive int16, recv_delay_numMillis int) *IOServer

IOServer 构造函数

func (*IOServer) OpenListen

func (this *IOServer) OpenListen(ip string, port uint16) error

OpenListen 打开侦听端口

func (*IOServer) SetPktParse

func (this *IOServer) SetPktParse(isenc bool, pktlen_size, pktses_size, pktcmd_size uint32)

func (*IOServer) SetReqChan

func (this *IOServer) SetReqChan(reqchan chan func())

type LsnSocket

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

LsnSocket 侦听端口表达

func (*LsnSocket) GetIP

func (this_lsn *LsnSocket) GetIP() string

func (*LsnSocket) GetPort

func (this_lsn *LsnSocket) GetPort() uint16

type Message

type Message interface {
	proto.Message
	Reset()
	String() string
	ProtoMessage()

	GetMsgName() string
	GetMsgCode() uint16
	GetThis() any
}

Message is implemented by generated protocol buffer messages.

type PaktAsynRet

type PaktAsynRet interface {
	AsynRet(retcode int8, retwpk *WPacket) bool
}

PaktAsynRet 异步返回包接口

func FetchPaktAsynRet

func FetchPaktAsynRet() PaktAsynRet
type PeerLink struct {
	// contains filtered or unexported fields
}

PeerLink ----------------SVRreg-------------------------

func NewPeerLink(connected bool, svr2sock *SVR2sock, peerlsnip []string, peerlsnport []uint32, peerver int32) *PeerLink

func NewPeerLink0

func NewPeerLink0() *PeerLink

func (*PeerLink) GetBegTime

func (this *PeerLink) GetBegTime() *time.Time

func (*PeerLink) GetConnected

func (this *PeerLink) GetConnected() bool

func (*PeerLink) GetPeerKind

func (this *PeerLink) GetPeerKind() uint8

func (*PeerLink) GetPeerLsnIP

func (this *PeerLink) GetPeerLsnIP() []string

func (*PeerLink) GetPeerLsnPort

func (this *PeerLink) GetPeerLsnPort() []uint32

func (*PeerLink) GetPeerName

func (this *PeerLink) GetPeerName() string

func (*PeerLink) GetPeerVer

func (this *PeerLink) GetPeerVer() int32

func (*PeerLink) GetSVR2sock

func (this *PeerLink) GetSVR2sock() *SVR2sock

func (*PeerLink) GetSvr2plyCount

func (this *PeerLink) GetSvr2plyCount() int
func (this *PeerLink) PeerLink(connected bool, svr2sock *SVR2sock,
	peerlsnip []string, peerlsnport []uint32, peerver int32) *PeerLink

type PeerMgr

type PeerMgr struct {
	zbsync.RWMutex
	// contains filtered or unexported fields
}

PeerMgr 对端会话管理

func NewPeerMgr

func NewPeerMgr() *PeerMgr
func (this *PeerMgr) DelPeerLink(peername string, svr2sock *SVR2sock) (sucs bool)

func (*PeerMgr) GetChanged

func (this *PeerMgr) GetChanged() bool

func (*PeerMgr) GetCount

func (this *PeerMgr) GetCount() int
func (this *PeerMgr) GetPeerLink(peername string) (link *PeerLink, found bool)
func (this *PeerMgr) GetPeerLinks() map[string]*PeerLink

func (*PeerMgr) Iterate

func (this *PeerMgr) Iterate(iterfunc func(peername string, peerlink *PeerLink) (isbreak bool))

func (*PeerMgr) PeerMgr

func (this *PeerMgr) PeerMgr() *PeerMgr

func (*PeerMgr) SetChanged

func (this *PeerMgr) SetChanged(changed bool)
func (this *PeerMgr) SetPeerLink(peername string, link *PeerLink)

type ProtAsynRet

type ProtAsynRet interface {
	AsynRet(retcode int8, retpb Message) bool
}

ProtAsynRet 异步返回message接口

func FetchProtAsynRet

func FetchProtAsynRet() ProtAsynRet

type RPacket

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

RPacket readable packet

func (*RPacket) RPacket

func (this *RPacket) RPacket(iosvr *IOServer) *RPacket

func (*RPacket) ReadCmd

func (this *RPacket) ReadCmd() (cmd uint16)

func (*RPacket) ReadDouble

func (this *RPacket) ReadDouble() (dou float64)

func (*RPacket) ReadErrno

func (this *RPacket) ReadErrno() (errno uint16)

func (*RPacket) ReadFloat

func (this *RPacket) ReadFloat() (flo float32)

func (*RPacket) ReadInt1

func (this *RPacket) ReadInt1() (v int8)

func (*RPacket) ReadInt2

func (this *RPacket) ReadInt2() (v int16)

func (*RPacket) ReadInt4

func (this *RPacket) ReadInt4() (v int32)

func (*RPacket) ReadInt8

func (this *RPacket) ReadInt8() (v int64)

func (*RPacket) ReadSESS

func (this *RPacket) ReadSESS() uint32

func (*RPacket) ReadSequence

func (this *RPacket) ReadSequence() (seq []byte)

func (*RPacket) ReadString

func (this *RPacket) ReadString() (str string)

func (*RPacket) ReadUInt1

func (this *RPacket) ReadUInt1() (v uint8)

func (*RPacket) ReadUInt2

func (this *RPacket) ReadUInt2() (v uint16)

func (*RPacket) ReadUInt4

func (this *RPacket) ReadUInt4() (v uint32)

func (*RPacket) ReadUInt8

func (this *RPacket) ReadUInt8() (v uint64)

func (*RPacket) ReverseReadDouble

func (this *RPacket) ReverseReadDouble() (dou float64)

func (*RPacket) ReverseReadFloat

func (this *RPacket) ReverseReadFloat() (flo float32)

func (*RPacket) ReverseReadInt1

func (this *RPacket) ReverseReadInt1() (v int8)

func (*RPacket) ReverseReadInt2

func (this *RPacket) ReverseReadInt2() (v int16)

func (*RPacket) ReverseReadInt4

func (this *RPacket) ReverseReadInt4() (v int32)

func (*RPacket) ReverseReadInt8

func (this *RPacket) ReverseReadInt8() (v int64)

func (*RPacket) ReverseReadString

func (this *RPacket) ReverseReadString() (str string)

func (*RPacket) ReverseReadUInt1

func (this *RPacket) ReverseReadUInt1() (v uint8)

func (*RPacket) ReverseReadUInt2

func (this *RPacket) ReverseReadUInt2() (v uint16)

func (*RPacket) ReverseReadUInt4

func (this *RPacket) ReverseReadUInt4() (v uint32)

func (*RPacket) ReverseReadUInt8

func (this *RPacket) ReverseReadUInt8() (v uint64)

func (*RPacket) WPacket

func (this *RPacket) WPacket(iosvr *IOServer) *WPacket

func (*RPacket) WriteCmd

func (this *RPacket) WriteCmd(cmd uint16) bool

func (*RPacket) WriteSESS

func (this *RPacket) WriteSESS(sessid uint32)

type SVR2base

type SVR2base struct {
	IOServer
	// contains filtered or unexported fields
}

SVR2base Server边基础对象

func (*SVR2base) BroadCastMsg

func (this *SVR2base) BroadCastMsg(svr2sock *SVR2sock, svr2plys []*SVR2ply, msg string, rpk *RPacket)

func (*SVR2base) GetMsgDir added in v1.0.1

func (this *SVR2base) GetMsgDir() uint8

func (*SVR2base) NotRegMessge

func (this *SVR2base) NotRegMessge(svr2sock *SVR2sock, svr2ply *SVR2ply, msg string, rpk *RPacket, parse func() Message, memptr ...uint32)

func (*SVR2base) OnConnect

func (this *SVR2base) OnConnect(datasock *Datasock) bool

func (*SVR2base) OnConnected

func (this *SVR2base) OnConnected(datasock *Datasock)

func (*SVR2base) OnDecode

func (this *SVR2base) OnDecode(datasock *Datasock, cipher []byte)

func (*SVR2base) OnDisconnected

func (this *SVR2base) OnDisconnected(datasock *Datasock, disc_reason int)

func (*SVR2base) OnEncode

func (this *SVR2base) OnEncode(datasock *Datasock, text []byte)

func (*SVR2base) OnProcPack

func (this *SVR2base) OnProcPack(datasock *Datasock, rpk *RPacket)

func (*SVR2base) OnServeCall

func (this *SVR2base) OnServeCall(datasock *Datasock, rpk *RPacket) (retcode int8, retwpk *WPacket)

func (*SVR2base) SVR2base

func (this *SVR2base) SVR2base(msgdir uint8, msgsvc SvrMsgSvc, dbg, recv_concurr, cmdUseName bool,
	pktlen_size, recv_alive, send_alive int16) *SVR2base

func (*SVR2base) SwitchRoutine

func (this *SVR2base) SwitchRoutine(svr2sock *SVR2sock, svr2ply *SVR2ply, msgname string, exefunc func())

type SVR2ply

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

SVR2ply Server上的player对象表示

func NewSVR2ply

func NewSVR2ply(outer any) *SVR2ply

func (*SVR2ply) AiMain

func (this *SVR2ply) AiMain(fun_init, fun_idle func())

func (*SVR2ply) AiRunning

func (this *SVR2ply) AiRunning() bool

func (*SVR2ply) AiStop

func (this *SVR2ply) AiStop()

func (*SVR2ply) AsynProt

func (this *SVR2ply) AsynProt(tmot_ms uint32, msgdir GetMsgDir, in_para Message, acb func(retcode int8, retpb Message)) error

func (*SVR2ply) DelSockRelation

func (this *SVR2ply) DelSockRelation(msgdir GetMsgDir) (myptr2peer uint32)

func (*SVR2ply) Get2PeerNum

func (this *SVR2ply) Get2PeerNum() int

func (*SVR2ply) GetMyPtr

func (this *SVR2ply) GetMyPtr() uint32

GetMyPtr 获取对端标记自己的指针

func (*SVR2ply) GetOuter

func (this *SVR2ply) GetOuter() any

GetOuter 获取外包对象的指针,可以直接用type断言转换成外包对象的指针

func (*SVR2ply) GetPeerPtr

func (this *SVR2ply) GetPeerPtr(msgdir GetMsgDir) (peerptr2me uint32)

func (*SVR2ply) GetSVR2sock

func (this *SVR2ply) GetSVR2sock(msgdir GetMsgDir) *SVR2sock

func (*SVR2ply) Get_ISonline

func (this *SVR2ply) Get_ISonline(msgdir GetMsgDir) bool

func (*SVR2ply) NewSockRelation

func (this *SVR2ply) NewSockRelation(svr2sock *SVR2sock, peerptr2me uint32) (old_svr2sock *SVR2sock, old_peerptr2me uint32)

NewSockRelation peerptr2me=INVALID_PEER2IPTR表示无效值,会被忽略

func (*SVR2ply) PostTask

func (this *SVR2ply) PostTask(cancel_all bool, task func() (cancel_all bool, new_tmout_ms int32))

func (*SVR2ply) SVR2ply

func (this *SVR2ply) SVR2ply(outer any) *SVR2ply

SVR2ply outer:必须是SVR2ply的外包对象的指针

func (*SVR2ply) SendP2All

func (this *SVR2ply) SendP2All(msgdir GetMsgDir, pb Message) error

func (*SVR2ply) SendPack

func (this *SVR2ply) SendPack(msgdir GetMsgDir, wpk *WPacket, memptr ...uint32) error

func (*SVR2ply) SendProt

func (this *SVR2ply) SendProt(msgdir GetMsgDir, pb Message, memptr ...uint32) error

func (*SVR2ply) SendProt4Ret

func (this *SVR2ply) SendProt4Ret(msgdir GetMsgDir, pb Message, tmout_ms int32, canbreak bool, retmsg []string, callback func(retpb Message) (breakwait bool)) (retpb Message, err int8)

func (*SVR2ply) SetPeerPtr

func (this *SVR2ply) SetPeerPtr(msgdir GetMsgDir, peerptr2me uint32)

SetPeerPtr 设置本地标记对端的数字指针

func (*SVR2ply) SyncProt

func (this *SVR2ply) SyncProt(tmot_ms uint32, msgdir GetMsgDir, in_para Message) (retcode int8, retpb Message)

func (*SVR2ply) Wait4Ret

func (this *SVR2ply) Wait4Ret(tmout_ms int32, canbreak bool, retmsg []string, callback func(retpb Message) (breakwait bool)) (retpb Message, err int8)

type SVR2sock

type SVR2sock struct {
	*Datasock
	zbsync.RWMutex
	// contains filtered or unexported fields
}

SVR2sock 面向server边的socket

func (*SVR2sock) AddPlayer

func (this *SVR2sock) AddPlayer(svr2ply *SVR2ply)

func (*SVR2sock) AsynProt

func (this *SVR2sock) AsynProt(tmot_ms uint32, svr2ply *SVR2ply, in_para Message, acb func(retcode int8, retpb Message), memptr ...uint32) error

func (*SVR2sock) ClearPlayer

func (this *SVR2sock) ClearPlayer(PERplyOuter func(SVR2plyOuter any))

func (*SVR2sock) DelPlayer

func (this *SVR2sock) DelPlayer(svr2ply *SVR2ply)

func (*SVR2sock) Disconnect

func (this *SVR2sock) Disconnect(discreason int, discfunc func()) int

func (*SVR2sock) FindSVR2ply

func (this *SVR2sock) FindSVR2ply(myptr2peer uint32) (svr2ply *SVR2ply, found bool)

func (*SVR2sock) Get2PeerNum

func (this *SVR2sock) Get2PeerNum() int

func (*SVR2sock) GetMsgDir added in v1.0.1

func (this *SVR2sock) GetMsgDir() uint8

func (*SVR2sock) GetPeerKind

func (this *SVR2sock) GetPeerKind() uint8

func (*SVR2sock) GetPeerName

func (this *SVR2sock) GetPeerName() string

func (*SVR2sock) GetSVR2PlyCount

func (this *SVR2sock) GetSVR2PlyCount() int

func (*SVR2sock) IsConnected

func (this *SVR2sock) IsConnected() bool

func (*SVR2sock) IteratePly

func (this *SVR2sock) IteratePly(PERplyOuter func(SVR2plyOuter any) bool) any

func (*SVR2sock) SVR2sock

func (this *SVR2sock) SVR2sock(datasock *Datasock, svr2base *SVR2base, pktcmd_size uint32) *SVR2sock

func (*SVR2sock) SendP2All

func (this *SVR2sock) SendP2All(pb Message) error

func (*SVR2sock) SendProt

func (this *SVR2sock) SendProt(svr2ply *SVR2ply, pb Message, memptr ...uint32) error

func (*SVR2sock) SetPeerKind

func (this *SVR2sock) SetPeerKind(peerkind uint8)

func (*SVR2sock) SetPeerName

func (this *SVR2sock) SetPeerName(peername string)

func (*SVR2sock) SyncProt

func (this *SVR2sock) SyncProt(tmot_ms uint32, svr2ply *SVR2ply, in_para Message, memptr ...uint32) (retcode int8, retpb Message)

type SvrMsgSvc

type SvrMsgSvc interface {
	IOSerivce
	SwitchRoutine(svr2sock *SVR2sock, svr2ply *SVR2ply, msg string, exefunc func())
	NotRegMessge(svr2sock *SVR2sock, svr2ply *SVR2ply, msg string, rpk *RPacket,
		parse func() Message, memptr ...uint32)
	BroadCastMsg(svr2sock *SVR2sock, svr2plys []*SVR2ply, msg string, rpk *RPacket)
}

SvrMsgSvc 服务器消息服务接口

type WPacket

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

WPacket writable packet

func (*WPacket) GetLen

func (this *WPacket) GetLen() int

func (*WPacket) RPacket

func (this *WPacket) RPacket(iosvr *IOServer) *RPacket

func (*WPacket) ReadCmd

func (this *WPacket) ReadCmd() (cmd uint16)

func (*WPacket) ReadSESS

func (this *WPacket) ReadSESS() uint32

func (*WPacket) WPacket

func (this *WPacket) WPacket(iosvr *IOServer) *WPacket

func (*WPacket) WriteCmd

func (this *WPacket) WriteCmd(cmd uint16) bool

func (*WPacket) WriteDouble

func (this *WPacket) WriteDouble(dou float64) bool

func (*WPacket) WriteErrno

func (this *WPacket) WriteErrno(errno uint16) bool

func (*WPacket) WriteFloat

func (this *WPacket) WriteFloat(flo float32) bool

func (*WPacket) WriteInt1

func (this *WPacket) WriteInt1(v int8) bool

func (*WPacket) WriteInt2

func (this *WPacket) WriteInt2(v int16) bool

func (*WPacket) WriteInt4

func (this *WPacket) WriteInt4(v int32) bool

func (*WPacket) WriteInt8

func (this *WPacket) WriteInt8(v int64) bool

func (*WPacket) WriteReverseString

func (this *WPacket) WriteReverseString(str string) bool

func (*WPacket) WriteSESS

func (this *WPacket) WriteSESS(sessid uint32)

func (*WPacket) WriteSequence

func (this *WPacket) WriteSequence(seq []byte) bool

func (*WPacket) WriteString

func (this *WPacket) WriteString(str string) bool

func (*WPacket) WriteUInt1

func (this *WPacket) WriteUInt1(v uint8) bool

func (*WPacket) WriteUInt2

func (this *WPacket) WriteUInt2(v uint16) bool

func (*WPacket) WriteUInt4

func (this *WPacket) WriteUInt4(v uint32) bool

func (*WPacket) WriteUInt8

func (this *WPacket) WriteUInt8(v uint64) bool

Jump to

Keyboard shortcuts

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