'opcua - not getting all values in the queue after setting sample rate
This is my code in python:
client = Client('opc.tcp://DESKTOP-D1B43P9.mshome.net:53530/OPCUA/SimulationServer')
client.connect()
counter = client.get_node("ns=3;i=1001")
handler = SubHandler()
sub = client.create_subscription(10000, handler)
handle = sub.subscribe_data_change(counter, queuesize=2)
sub.modify_monitored_item(handle, 500)
If I don't change the sampling rate (remove the last line), I get two values (datachange_notification is called twice in a row) every 10 seconds. But if I do change the sampling rate, it's called only once.
Solution 1:[1]
It looks like when you call modify_monitored_item
and don't specify the new_queuesize
it defaults to 0, which tells the server to set it to "default" queue size, which is 1 according to the spec.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kevin Herron |