点击或拖拽改变大小

NetworkDoubleBaseSetPersistentConnection 方法

在读取数据之前可以调用本方法将客户端设置为长连接模式,相当于跳过了ConnectServer的结果验证,对异形客户端无效,当第一次进行通信时再进行创建连接请求。
Before reading the data, you can call this method to set the client to the long connection mode, which is equivalent to skipping the result verification of ConnectServer, and it is invalid for the alien client. When the first communication is performed, the connection creation request is performed.

命名空间:  HslCommunication.Core.Net
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public void SetPersistentConnection()
示例
以下的方式演示了另一种长连接的机制
SetPersistentConnection示例
client.SetPersistentConnection( );        // 设置长连接,但是不立即连接,等到第一次读写的时候再启动连接。
System.Threading.Thread.Sleep( 10000 );   // 休眠10秒



// 调用write时才是真正的启动连接,后续的读写操作重复利用该连接,此处的地址示例是modbus的地址,对于读取也是一样的
OperateResult write = client.Write( "100", 123 );
参见