Documentation ¶
Index ¶
- Variables
- func NewClient(id string, ip string, port int) *client
- type Connection
- func (c *Connection) GetConnId() uint32
- func (c *Connection) GetProperty(key string) (interface{}, error)
- func (c *Connection) GetTCPConnection() *net.TCPConn
- func (c *Connection) RemoteAddr() net.Addr
- func (c *Connection) RemoveProperty(key string)
- func (c *Connection) SendBuffMsg(msgId uint32, data []byte) error
- func (c *Connection) SendMsg(msgId uint32, data []byte) error
- func (c *Connection) SetProperty(key string, value interface{})
- func (c *Connection) Start()
- func (c *Connection) StartReader()
- func (c *Connection) Stop()
Constants ¶
This section is empty.
Variables ¶
View Source
var (
HEART_MSG = "heart_msg"
)
Functions ¶
Types ¶
type Connection ¶
type Connection struct { //当前Conn属于哪个Server Client yiface.IClient //当前conn属于哪个server,在conn初始化的时候添加即可 sync.RWMutex //当前连接的套接字 Conn *net.TCPConn //当前连接的ID,也可以作为sessionID,全局唯一 ConnId uint32 //消息管理MsgId和对应处理方法的消息管理模块 MsgHandler yiface.IMsgHandle // contains filtered or unexported fields }
func NewConnection ¶
func NewConnection(client yiface.IClient, conn *net.TCPConn, handle yiface.IMsgHandle) *Connection
func (*Connection) GetConnId ¶
func (c *Connection) GetConnId() uint32
func (*Connection) GetProperty ¶
func (c *Connection) GetProperty(key string) (interface{}, error)
func (*Connection) GetTCPConnection ¶
func (c *Connection) GetTCPConnection() *net.TCPConn
func (*Connection) RemoteAddr ¶
func (c *Connection) RemoteAddr() net.Addr
func (*Connection) RemoveProperty ¶
func (c *Connection) RemoveProperty(key string)
func (*Connection) SendBuffMsg ¶
func (c *Connection) SendBuffMsg(msgId uint32, data []byte) error
func (*Connection) SetProperty ¶
func (c *Connection) SetProperty(key string, value interface{})
func (*Connection) Start ¶
func (c *Connection) Start()
func (*Connection) Stop ¶
func (c *Connection) Stop()
Click to show internal directories.
Click to hide internal directories.