Documentation ¶
Index ¶
- Constants
- func BinaryCoder(req interface{}) ([]byte, error)
- func BinaryDecoder(buf []byte, rsp interface{}) error
- func GetUint32(body []byte) uint32
- func GetUint64(body []byte) uint64
- func NewConnect(conn net.Conn, buflen int) *connect
- func PutUint32(value uint32, body []byte)
- func PutUint64(value uint64, body []byte)
- type Client
- type ClientHandler
- type Header
- type Listen
- type Server
- type ServerHandler
- type Stat
Constants ¶
View Source
const ( MAX_BUF_SIZE = 128 * 1024 // 缓冲区大小(单位:byte) MAGIC_FLAG = 0x98b7f30a // 校验魔术字 MSG_HEAD_LEN = 3 * 4 // 消息头长度 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
客户端实例的数据结构
func (*Client) RegHandler ¶
func (c *Client) RegHandler(reqid uint32, fun ClientHandler) error
注册客户端消息处理函数
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
server端控制结构
func (*Server) RegHandler ¶
func (s *Server) RegHandler(reqid uint32, fun ServerHandler) error
注册消息处理函数
Click to show internal directories.
Click to hide internal directories.