Professional OPC
Development Tools


Disconnect and reconnect parameters

12 Apr 2019 06:04 - 12 Apr 2019 06:05 #7321 by support
I do not think there are any intervals "hidden". But the whole OPC UA communication is a complex issue - that's why you are using as toolkit and not programming it yourself - and there are many more aspects that have to with the reliability of the communication. For example, subscription-level keep-alive mechanism etc.

Ad 1. No. The keep-alive interval is set for all non-isolated EasyUAClient objects at once, using AdaptableParameters, and for each isolated EasyUAClient in its IsolatedParameters, but if you are using more servers on the same EasyUAClient, they all share the same keep interval.

Ad 2. You cannot currently obtain the effective keep-alive interval. As I wrote before, however, the server isn't actually "revising" it - that was my mistake, I confused it with other parameters. Normally, the effective keep-alive interval is the same number as you specify. There are some edge cases (which also depend on the server) in which it isn't. For example, in the current implementation, it cannot be shorter than 10 ms, and it cannot be longer than certain percentage of the session timeout as revised by the server. But this is implementation dependent, subject to change, and do not expect us to ever reveal all the related details.

Ad 3. See above - there is no "revised" keep-alive interval, so to speak. I think that in your case, as in 99% of cases anyway, the actual value used will be the one you specify. The client then tries to issue some request to the server at least every keep-alive interval, and uses the value twice as longer to detect when the server is not responding.

Ad 4. The recommendation is: Use Isolated == true only when you have to. Examples of such situations are:
a) For whatever reason, you need two or more sessions to the same server.
b) You need to set some parameters differently for certain servers.
c) You are writing a reusable software library, so you do not want to "share" the parameters and connections to servers etc. with other parts of the larger environment your library will live in and which may also use EasyXXClient objects for something else.

Best regards
Last edit: 12 Apr 2019 06:05 by support.

Please Log in or Create an account to join the conversation.

11 Apr 2019 10:34 #7320 by veda
More testing:)

As posted I changed the "object".IsolatedParameters.SessionParameters.KeepAliveInterval, but our client is not set to Isolated mode. When changing EasyUAClient.AdaptableParameters.SessionParameters.KeepAliveInterval the client responded as expected. Are there more "hidden" KeepAliveIntervals?

A couple of questions related to this:
1. Is it possible to set KeepAliveInterval seperately for each OPC Server if not running in Isolated mode and using EasyUAClient.AdaptableParameters.SessionParameters.KeepAliveInterval?

2. When the server is revising and possibly changing the requested KeepAliveInterval, is it possible to read the revised number?

3. Will the timeout calculation use two times the revised KeepAliveInterval or requested KeepAliveInterval?

4. Is there any recommendations with regards to using Isolated mode in general? Today our design is one client instance for each OPC server, but we do not set the Isolated parameter. What are the pros and cons of Isolated mode?

Please Log in or Create an account to join the conversation.

10 Apr 2019 14:14 #7318 by support
Well, there is also KeepAliveIntervalDebug, if it's running under the debugger.

Besides that, changing the right one (or changing them both), should be enough. I have set them to 500 (ms), and I am notified of the disconnect in what I estimate to be not much more than 1 second, certainly less than 2 seconds. Tested with the ConnectivityExplorer application, and a connection to our public demo server.


Please Log in or Create an account to join the conversation.

10 Apr 2019 08:21 #7317 by veda
There must be more to it...? I have now made several clients with different IsolatedParameters.SessionParameters.KeepAliveInterval; 1000ms, 5000ms, 10000ms and 20000ms. They all report disconnect at the same time (approximately after 10 seconds). Are there no other parameters controlling the disconnect?

Note: KeepAliveInterval is changed on the client object after it is created, but before it is connected to the server.

Please Log in or Create an account to join the conversation.

09 Apr 2019 09:04 #7314 by support
First of all, I apologize for somewhat misleading you: The server does not revise the KeepAliveInterval. I have confused it with the keep-alive mechanism on the subscription level (which may also be of interest, but is a different thing altogether).

Second, by inspecting the code, I have found that the actual detection of keep-alive error you a value that is twice as much as KeepAliveInterval. So, with the default being 5000 ms, it comes to 10 seconds. This particular behavior is not in our code, it is in the OPC Foundation stack/SDK that we are using.

I am not sure which particular log entry you refer to as "timeout", but it can be something that does not directly cause a connection to be marked as being in failure.

Best regards

Please Log in or Create an account to join the conversation.

08 Apr 2019 07:10 #7310 by veda
Tried to experiment with different values for KeepAliveInterval. I have tried to set the server to accept low values for testing. Some questions:
- If the server does not approve of the KeepAliveInterval, will the variable "IsolatedParameters.SessionParameters.KeepAliveInterval" be updated or can I view the final value elsewhere?
- When timing with a stopwatch the time from unplugging network cable to Disconnect event is received, we always see (substantially) higher time than KeepAliveInterval. The time is between 12-20 seconds with KeepAliveInterval to 5sec. Is there some other parameters affecting this?
- There seems to be a small delay between the EasyUAClient.LogEntry for timeout and the ServerConditionChanged event (maybe 1 to 3 sec).

Please Log in or Create an account to join the conversation.

05 Apr 2019 10:41 #7304 by support
And warning #4 to the shorter keep-alive intervals, for completeness:
- They increase the load on the server, the network, and the client.


Please Log in or Create an account to join the conversation.

05 Apr 2019 09:06 #7300 by support
Regarding the "disconnection detection" part:

This is what KeepAliveInterval ( ) or KeepAliveIntervalDebug is for.

Default is 5000 (5 seconds), you can make it shorter to detect problems quicker.

But there are some warnings:
1. By doing so, you increase the possibility of "falsely positive" detections.
2. The value you specify is not final. It gets negotiated with the server, and the server has the final word (this must be so, for conformance with OPC UA specs). It may happen that the server will not go under certain limit.
3. There is no determinism ("hard real time") in OPC UA Client-Server specs, and neither it is in the Ethernet network nor in Windows. This can work in both ways: It may cause false positives (see #1), but also false negatives (the disconnection will be detected later than wished, because simply the Windows threads of your app won't get chance to run soon enough).

Best regards

Please Log in or Create an account to join the conversation.

05 Apr 2019 07:16 #7299 by support

For the reconnection part (I understand this is the less important piece):

See the RetrialDelay property, . Default is 10000 (10 seconds), you may make it shorter.

In order for this to work, you need to also consider that the reconnection does not happen immediately after this period elapses.Instead, the global component's "engine" checks all sessions in a periodic task, and initiates a reconnection of those that are due for reconnection. See . This can only be set once, before you start any OPC operations. Default is 5000 (5 seconds), so the total time to the (initiation of the) reconnection, in the default state, can be approximately 10-15 seconds.

I will reply to the part about disconnection detection timing in a separate post later. I need to verify something before I answer.

Best regards

Please Log in or Create an account to join the conversation.

04 Apr 2019 10:28 #7296 by veda
Our OPC client is used for "realtime" evaluation of data in a closed high speed network. If we have an issue with OPC server connections we need to know this within a few seconds to be sure that the users do not take decissions based on old data. It is ok with some time before the client reconnects to the server after a disconnect, but we need a short time before the disconnect is detected (typically 2 seconds). When we e.g physically disconnect the network cable it takes about 20 seconds before we get a disconnect event from the EasyUAClient.

Can you guide us to the relevant parameters that controls the reconnect/disconnect timings and any potential considerations we need to know about?


Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.223 seconds


 Recommend this on Google