点击或拖拽改变大小

HslExtensionSetKeepAlive 方法

设置套接字的活动时间和活动间歇时间,此值会设置到socket低级别的控制中,传入值如果为负数,则表示不使用 KeepAlive 功能。
Set the active time and active intermittent time of the socket. This value will be set to the low-level control of the socket. If the incoming value is a negative number, it means that the KeepAlive function is not used.

命名空间:  HslCommunication
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public static int SetKeepAlive(
	this Socket socket,
	int keepAliveTime,
	int keepAliveInterval
)

参数

socket
类型:System.Net.SocketsSocket
套接字对象
keepAliveTime
类型:SystemInt32
保持活动时间
keepAliveInterval
类型:SystemInt32
保持活动的间歇时间

返回值

类型:Int32
返回获取的参数的字节

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型 Socket 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。
参见