OPCFoundation / UA-LDS

Local Discovery Server
45 stars 48 forks source link

LDS cache update #80

Open mtektas opened 1 year ago

mtektas commented 1 year ago

Hello, I'm writing an OPC UA client application. I have installed the LDS-ME service on the machine that the client application runs on it. I have embedded devices and each device has its own OPC UA server. They announce themselves via mDNS and I can get the list of servers (devices) by calling the FindServersOnNetwork function. When a device is added to the network and after power on device announces itself via mDNS. Up to now, everything works seamlessly. The problem is if a device is shut down or unplugged from the network LDS still keeps that device info and the list returned from FindServersOnNetwork is not up-to-date. I tried restarting LDS from my client application but it needs administrative privileges so the customer who uses the client application may not have admin privileges. Is there any suggestion to solve this problem? How can I refresh the LDS cache in order to get up to date server list?

erhardgrishaber commented 1 year ago

This is a bug in the LDS. When registering via OPC-UA (RegisterServer/RegisterServer2) a timestamp is added; this is compared to the "ExpirationMaxAge = 600" (see configuration file) and if the entry is too old, it is removed. This does not happen when registering via mDNS only. I will make a fix next week for this.