go-study/zinx/ziface/iconnection.go
2025-09-14 18:12:02 +08:00

21 lines
598 B
Go

package ziface
import "net"
type IConnection interface {
// Start 启动连接
Start()
// Stop 停止连接
Stop()
// GetTCPConnection 获取当前连接的 TCP Socket 套接字
GetTCPConnection() *net.TCPConn
// GetConnID 获取当前连接 ID
GetConnID() uint32
// RemoteAddr 获取远程客户端地址信息
RemoteAddr() net.Addr
// SendMsg 发送数据,将数据发送给远程的客户端(无缓冲)
SendMsg(msgID uint32, data []byte) error
// SendBuffMsg 发送数据,将数据发送给远程的客户端(有缓冲)
SendBuffMsg(msgID uint32, data []byte) error
}