HslTimeOut.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Net.Sockets;
  6. using System.Net;
  7. using System.Threading;
  8. using MECF.Framework.RT.Core.ThreadLock;
  9. namespace MECF.Framework.RT.Core.IoProviders.Common.Net
  10. {
  11. /****************************************************************************
  12. *
  13. * 应用于一些操作超时请求的判断功能
  14. *
  15. * When applied to a network connection request timeouts
  16. *
  17. ****************************************************************************/
  18. /// <summary>
  19. /// 超时操作的类 [a class use to indicate the time-out of the connection]
  20. /// </summary>
  21. internal class HslTimeOut
  22. {
  23. /// <summary>
  24. /// 实例化对象
  25. /// </summary>
  26. public HslTimeOut()
  27. {
  28. StartTime = DateTime.Now;
  29. IsSuccessful = false;
  30. HybirdLock = new SimpleHybirdLock( );
  31. }
  32. /// <summary>
  33. /// 操作的开始时间
  34. /// </summary>
  35. public DateTime StartTime { get; set; }
  36. /// <summary>
  37. /// 操作是否成功
  38. /// </summary>
  39. public bool IsSuccessful { get; set; }
  40. /// <summary>
  41. /// 延时的时间,单位毫秒
  42. /// </summary>
  43. public int DelayTime { get ; set ; }
  44. /// <summary>
  45. /// 连接超时用的Socket
  46. /// </summary>
  47. public Socket WorkSocket { get; set; }
  48. /// <summary>
  49. /// 用于超时执行的方法
  50. /// </summary>
  51. public Action Operator { get; set; }
  52. /// <summary>
  53. /// 当前对象判断的同步锁
  54. /// </summary>
  55. public SimpleHybirdLock HybirdLock { get; set; }
  56. }
  57. }