/* * *************************************************************************** * * 应用于一些操作超时请求的判断功能 * * When applied to a network connection request timeouts * * ************************************************************************** */ using System; using System.Net.Sockets; namespace TFT_MelsecMcNet { /// /// 自定义 超时操作的类 [a class use to indicate the time-out of the connection] /// internal class SylTimeOut { /// /// 实例化对象 /// public SylTimeOut() { StartTime = DateTime.Now; IsSuccessful = false; HybirdLock = new SimpleHybirdLock(); } /// /// 操作的开始时间 /// public DateTime StartTime { get; set; } /// /// 操作是否成功 /// public bool IsSuccessful { get; set; } /// /// 延时的时间,单位毫秒 /// public int DelayTime { get; set; } /// /// 连接超时用的Socket /// public TcpClient WorkSocket { get; set; } /// /// 用于超时执行的方法 /// public Action Operator { get; set; } /// /// 当前对象判断的同步锁 /// public SimpleHybirdLock HybirdLock { get; set; } } }