点击或拖拽改变大小

HslTimeOut 类

超时操作的类
a class use to indicate the time-out of the connection
继承层次
SystemObject
  HslCommunicationHslTimeOut

命名空间:  HslCommunication
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法
public class HslTimeOut

HslTimeOut 类型公开以下成员。

构造函数
  名称说明
公共方法HslTimeOut
实例化一个默认的对象
Instantiate a default object
Top
属性
  名称说明
公共属性DelayTime
延时的时间,单位毫秒
Delay time, in milliseconds
公共属性IsSuccessful
操作是否成功,当操作完成的时候,需要设置为True,超时检测自动结束。如果一直为False,超时检测到超时,设置IsTimeoutTrue
Whether the operation is successful, when the operation is completed, it needs to be set to True, and the timeout detection will automatically end. If it is always False, the timeout is detected by the timeout, set IsTimeout to True
公共属性IsTimeout
是否发生了超时的操作,当调用方因为异常结束的时候,需要对IsTimeout进行判断,是否因为发送了超时导致的异常
Whether a timeout operation has occurred, when the caller ends abnormally, it needs to judge IsTimeout, whether it is an exception caused by a timeout sent
公共属性StartTime
操作的开始时间
Start time of operation
公共属性静态成员TimeOutCheckCount
获取当前检查超时对象的个数
Get the number of current check timeout objects
公共属性静态成员TimeoutLogNet
获取或设置当前的超时线程的状态日志信息,只要实例化,即可记录当前的超时日志运行信息
Obtain or set the status log information of the current timeout thread, and record the current timeout log operation information as long as it is instantiated
公共属性UniqueId
当前超时对象的唯一ID信息,没实例化一个对象,id信息就会自增1
The unique ID information of the current timeout object. If an object is not instantiated, the id information will increase by 1
公共属性WorkSocket
连接超时用的Socket,本超时对象主要针对套接字的连接,接收数据的超时检测,也可以设置为空,用作其他用途的超时检测。
Socket used for connection timeout. This timeout object is mainly for socket connection and timeout detection of received data. It can also be set to empty for other purposes.
Top
方法
  名称说明
公共方法Equals
Determines whether the specified object is equal to the current object.
(继承自 Object。)
受保护的方法Finalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(继承自 Object。)
公共方法GetConsumeTime
获取到目前为止所花费的时间
Get the time spent so far
公共方法GetHashCode
Serves as the default hash function.
(继承自 Object。)
公共方法静态成员GetHslTimeOutsSnapShoot
获取当前的所有的等待超时检查对象列表,请勿手动更改对象的属性值
Get the current list of all waiting timeout check objects, do not manually change the property value of the object
公共方法GetType
Gets the Type of the current instance.
(继承自 Object。)
公共方法静态成员HandleTimeOutCheck(HslTimeOut)
新增一个超时检测的对象,当操作完成的时候,需要自行标记HslTimeOut对象的IsSuccessfulTrue
Add a new object for timeout detection. When the operation is completed, you need to mark the IsSuccessful of the HslTimeOut object as True
公共方法静态成员HandleTimeOutCheck(Socket, Int32)
新增一个超时检测的对象,需要指定socket,超时时间,返回HslTimeOut对象,用作标记完成信息
Add a new object for timeout detection, you need to specify the socket, the timeout period, and return the HslTimeOut object for marking completion information
受保护的方法MemberwiseClone
Creates a shallow copy of the current Object.
(继承自 Object。)
公共方法ToString
Returns a string that represents the current object.
(重写 ObjectToString.)
Top
字段
  名称说明
公共字段静态成员TimeoutDealCount
当前的超时对象处理的总个数,如果需要重置该值,方便重新计数,请调用如下代码:long current = Interlocked.Exchange( ref HslCommunication.HslTimeOut.TimeoutDealCount, 0 );
The total number of timeout objects processed at present, if you need to reset the value to facilitate recounting, call the following code: long current = Interlocked.Exchange( ref HslCommunication.HslTimeOut.TimeoutDealCount, 0 );
Top
扩展方法
  名称说明
公共扩展器方法ToJsonString
获取当前对象的JSON格式表示的字符串。
Gets the string represented by the JSON format of the current object.
(由 HslExtension 定义。)
Top
备注
本类自动启动一个静态线程来处理
参见