Documentation ¶
Overview ¶
*
- Copyright gitteamer 2020
- @date: 2020/11/10
- @note: address
*
- Copyright gitteamer 2020
- @date: 2020/11/10
- @note: server connect manager
*
- Copyright gitteamer 2020
- @date: 2020/11/10
- @note: error
*
- Copyright gitteamer 2020
- @date: 2020/11/10
- @note: message
*
- Copyright gitteamer 2020
- @date: 2020/11/10
- @note: tcp server
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addr ¶
*
- author gitteamer 2020/11/10
- address info
func NewAddr ¶
*
- author gitteamer 2020/11/10 *
- new a Addr obj
- @param string address: input address
- @return Addr obj pointer
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
*
- author gitteamer 2020/11/10
- tcp client struct
func (*Client) OnRecv ¶
func (c *Client) OnRecv(handle ClientRecvHandle)
*
- author gitteamer 2020/11/10
- register receive event callback function
- @param ClientRecvHandle handle: callback function
type ClientRecvHandle ¶
type ClientRecvHandle = func(recv *Message)
*
- author gitteamer 2020/11/10
- receive event callback function
type Connect ¶
type Connect struct {
// contains filtered or unexported fields
}
*
- author gitteamer 2020/11/10
- client connect info, receive chan, send chan
- Please use NewConnect() to create connect obj.
type ConnectHandle ¶
type DisconnectHandle ¶
type DisconnectHandle = func(addr *Addr)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
*
- author gitteamer 2020/11/10
- tcp server.
- Please use NewServer() to create server obj.
func (*Server) Close ¶
func (s *Server) Close()
*
- author gitteamer 2020/11/10
- close server and recycling resources
func (*Server) OnConnect ¶
func (s *Server) OnConnect(handle ConnectHandle)
*
- author gitteamer 2020/11/10
- register callback function when a client connect
- @param ConnectHandle handle: callback function
func (*Server) OnDisconnect ¶
func (s *Server) OnDisconnect(handle DisconnectHandle)
*
- author gitteamer 2020/11/10
- register callback function when a client disconnect
- @param DisconnectHandle handle: callback function
func (*Server) OnRecv ¶
func (s *Server) OnRecv(handle ServerRecvHandle)
*
- author gitteamer 2020/11/10
- register callback function when receive data
- @param RecvHandle handle: callback function
type ServerRecvHandle ¶
*
- author gitteamer 2020/11/10
- the callback function for event
- @param *Message req: the message recv from client connect
- @return *Message: the message response to client. if the message is nil, then do nothing
Source Files ¶
Click to show internal directories.
Click to hide internal directories.