You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
604 B

  1. package ziface
  2. import "net"
  3. //定义连接接口
  4. type IConnection interface {
  5. //启动连接,让当前连接开始工作
  6. Start()
  7. //停止连接,结束当前连接状态M
  8. Stop()
  9. //从当前连接获取原始的socket TCPConn
  10. GetTCPConnection() *net.TCPConn
  11. //获取当前连接ID
  12. GetConnID() uint32
  13. //获取远程客户端地址信息
  14. RemoteAddr() net.Addr
  15. //直接将Message数据发送数据给远程的TCP客户端(无缓冲)
  16. SendMsg(msgId uint32, data []byte) error
  17. //直接将Message数据发送给远程的TCP客户端(有缓冲)
  18. SendBuffMsg(msgId uint32, data []byte) error
  19. }