Only OPC DA V3 servers support the keep alive feature. The OPCDA.NET Professional Edition emulates the keep alive feature for servers that don't implement the OPC DA V3 IOPCGroupStateMgt2 interface. Some servers may implement the interface but not the method. In this case the OpcServer.DeclareV2 property has to be set to force the emulation to be used. The emulation has a client side thread that makes periodically GetStatus server calls and executes keepalive DataChange callbacks accourding the OPC DA V3 keep alive specification.
Clients can set the keep-alive time for a subscription to cause the server to provide client callbacks on the subscription when there are no new events to report. Clients can then be assured of the health of the server and subscription without resorting to pinging the server with calls to GetStatus(). Using this facility, a client can expect a callback (data or keep-alive) within the specified keep-alive time.
Servers shall reset their keep-alive timers when real data is sent (i.e. it is not acceptable to constantly send the keep-alive callback at a fixed period equal to the keep-alive time irrespective of data callbacks).
Visual Basic (Declaration) | |
---|---|
Public Function SetKeepAlive( _ ByVal keepAliveRate As Integer, _ ByRef revKeepAliveRate As Integer _ ) As Integer |
C# | |
---|---|
public int SetKeepAlive( int keepAliveRate, out int revKeepAliveRate ) |
Parameters
- keepAliveRate
- The maximum amount of time (in milliseconds) between subscription callbacks. A value of zero indicates the server will not send any empty keep-alive callbacks.
- revKeepAliveRate
- The KeepAliveTime the server is actually providing, which may differ from keepAliveRate.