IRemoteSession.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. namespace XGame.Framework.Network
  2. {
  3. public enum SessionStatus
  4. {
  5. NONE,
  6. CONNECTING,
  7. CONNECTED,
  8. CONNECT_TIMEOUT,
  9. CONNECT_FAIL,
  10. FREE,
  11. DISCONNECT_ERROR,
  12. SEND_ERROR,
  13. RECV_ERROR,
  14. CLOSED
  15. }
  16. public interface IRemoteSession
  17. {
  18. /// <summary>
  19. /// 会话状态
  20. /// </summary>
  21. SessionStatus Status { get; }
  22. /// <summary>
  23. /// 远端地址解析信息
  24. /// </summary>
  25. SessionAddress Address { get; }
  26. /// <summary>
  27. /// 是否连接
  28. /// </summary>
  29. /// <param name="bPrecice"></param>
  30. /// <returns></returns>
  31. bool IsConnected(bool bPrecice);
  32. /// <summary>
  33. /// 断开连接
  34. /// </summary>
  35. void Disconnect();
  36. /// <summary>
  37. /// 发送
  38. /// </summary>
  39. /// <param name="bytes"></param>
  40. /// <param name="offset"></param>
  41. /// <param name="length"></param>
  42. /// <returns></returns>
  43. bool Send(byte[] bytes, int offset, int length);
  44. /// <summary>
  45. /// 连接
  46. /// </summary>
  47. /// <param name="ip"></param>
  48. /// <param name="port"></param>
  49. void Connect(AddressInfo address);
  50. }
  51. }