01-04-2023 03:55 AM
使用DATa Socket 进行OPC通讯时,打开以后未加延时,直接进行读取,读取Datasocket的质量返回8,
|
然后高亮运行程序,读取正常。
测试是由于打开DataSocket后直接进行读取DataSocket导致的问题,
再打开DATa Socket后添加延时后读取DataSocket正常。
必须得在打开后添加延时才可以正常读取吗?
大概测试了一下,这个延时至少得30ms才能够保证正常读取。
有没有什么方法可以不需要延时?
01-04-2023 04:25 AM
01-04-2023 04:27 AM
这个延时是必须的吗?
01-04-2023 04:30 AM
是不是可以通过提前将需要使用的DataSocket打开,实现循环读取,这样就可以避免使用延时,或者使用一个较短的延时?
01-04-2023 06:20 AM - edited 01-04-2023 06:21 AM
Hi rttyyn,
@rttyyn..ZY95 wrote:
Is it possible to open the DataSocket that needs to be used in advance to realize cyclic reading, so that the delay can be avoided, or a shorter delay can be used?
Suggestion: open the datasocket once before the loop, read inside a loop and close once after the loop.
Again: why do you need to open/close the DS connection so often?
Btw. it really helps to write your messages in English when you want to get answers in an English speaking worldwide forum! (Otherwise I'm tempted to move your thread into the Chinese regional board…)