Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Read/Write Session Parameters

More
30 May 2014 12:14 #2021 by cdunlap
Thanks again!

I tried using Timeout.Infinite but it seems to act a little wonky (connection doesn't seem to stay alive a consistent amount of time. It fluctuates from a few seconds to longer times). I will play around with it a little more when later on. It is definitely not really needed. I think 10-15 seconds will be sufficient since at least one operation should be done that often.

We had been using the subscribe "work-around" previously but would rather not have to do that to be consistent with another application (the old DA client uses reads exclusively over subscriptions).

I will also let you know about the Properties Window.

Thanks.

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

More
30 May 2014 06:20 #2018 by support
Hi, no need to apologize. In fact this part is not as obvious as I wish it to be, but I still struggle to satisfy the "user-friendliness" requirement while keeping a technically reasonable underlying design.

Some more notes:

- The same should work from the Properties window on the EasyUAClient component - if it does not, there may be a problem somewhere.
- Please let me know if setting the HoldPeriod to Timeout.Infinite works. I know you cannot wait infinitely long to prove that it works :-) but it should not fail and should keep the connection open.
- On the other hand, I can't imagine why "infinite" should be truly needed, because your app must be doing something to that server at some point time, or not?
- You can also hold the connection open by subscribing to some *other* node.
- The requirement for better control over the connections/disconnections is a recurring one. I plan to look at it seriously in some future version. But it kind of goes against the principles we have built upon, so it will be tough to integrate the two.

Best regards

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

More
29 May 2014 20:35 #2016 by cdunlap
Hi,

That was what I was missing. I set it that to true and the HoldPeriod to 10000 and it lasted 10 seconds.

I will see if that is sufficient for the project.

Thanks for the help - sorry I missed something so obvious!

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

More
29 May 2014 20:13 - 29 May 2014 20:13 #2015 by support
Let's first explore it with the code, and leave the Properties window for later.

In order for the easyUAClient1.IsolatedAdaptableParameters to work, you also need to set easyUAClient1.Isolated = true. Have you done that?
Last edit: 29 May 2014 20:13 by support.

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

More
29 May 2014 19:04 - 29 May 2014 20:14 #2014 by cdunlap
Hi,

I tried using the Properties view in Visual Studio to set the HoldPeriod and also tried
 
easyUAClient1.IsolatedAdaptableParameters.Session.HoldPeriod = System.Threading.Timeout.Infinite;//tried 10000 as well
 

I did notice that if I used the Properties window to set the HoldPeriod, re-build the program, save, close Visual Studio, and then re-open visual studio, the HoldPeriod property was back to the default 5000.

I am using version 5.30.514.1 of the dlls.

I can try to take a look at that tool and see what is going on there.

The way we have OmniServer configured, it is desirable to keep the session permanently because when the session is lost and re-connected, the server sets a default value to that particular item.

Thank you for the input.
Last edit: 29 May 2014 20:14 by support.

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

More
29 May 2014 18:40 #2013 by support
Can you please post the code you use to set the parameters, incl. HoldPeriod, and the version/build number used?

You can use the UA Compliance Test Tool (CTT), it does a job similar to OPC Analyzer. it has some limitations, though (such as it only does OPC.TCP, and it limits the security options).

If you do not need all details, you can just hook to the static EasyUAClient.LogEntry event, and observer the events there. There are events generated for opening/closing sessions.

What is the particular reason for the need to keep the session permanently open?
We haven't designed for this, but it might be possible, with the "infinite" hold period, but I need to check.

Best regards

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

More
29 May 2014 17:52 #2012 by cdunlap
I had tried setting the Hold Period to 10000 ms, but it appears to still be released after 5 seconds. I also tried setting it to Timeout.Infinite (not sure if this would work or not anyway) but it did not have any affect.

Is there a proper way to debug this situation and look at the sessions being created/released? Something similar to OPC Analyzer for UA servers? I am unsure if a wireshark capture would tell us anything useful or not.

The end goal for this particular project/use case would be to have the session persist from the time the client creates it until the client is destroyed. Is this possible using only reads? A workaround is obviously creating a subscription, but reads are preferred for this application.

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

More
29 May 2014 17:23 #2011 by support
The expected behavior is roughly as follows:

Whenever something from the server is needed, a session is "requested", and its usage count incremented; when it is no longer needed, the session is "released", and its usage count decremented.

"Something needed" mentioned above may be a one-shot operation (e.g. Read, or Write, and others). In this case the session is requested, the operation performed, and then released. Or, it may be a Subscribe; in such case, it does just the request part, and Unsubscribe does the release part.

Whenever the usage count goes from 0 to 1, the connection is attempted.
Whenever the usage count goes back from 1 to 0, the connection is closed - but possibly not immediately; it may be closed after a so-called "hold period" or a bit later.

There is "garbage collector" thread that goes over all existing sessions, and closes those that are no longer needed (their usage count is zero) AND are after their hold period.

The default hold period is 5 seconds; the default period (frequency) of the garbage collector is 2 seconds. This means that by default, an unused session should be closed after 5 to (5 + 2) = 7 seconds of inactivity. It should not matter whether that "inactivity" means "one or two reads", or "unsubscribe from everything".

If you do see something that does not conform to this expected behavior, please let me know.

Best regards

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

More
29 May 2014 16:24 #2010 by cdunlap
Hi,

I have some further information to add.

I notice that if I do 2 reads of the same item in quick succession, the connection will stay open longer. There are some internal optimizations that handle this correct?

I am assuming that when the initial read happens, it tries to establish a connection to the server and then reads the item. After that, what happens? If certain time elapses, it gets rid of the item (makes it inactive?) and if there are no active items the connection is closed?

Thank you for input.

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

More
28 May 2014 20:08 #2009 by cdunlap
Hi,

I am wondering what (if any) of the parameters apply to keeping the connection to the OPC UA server alive after a read or write (not a subscription).

For example, I am reading items from OmniServer (www.omnidssi.com/) where I have created a custom protocol for my device. It has a diagnostics window that shows the current value of all of the items it has configured.

Whenever I do a read, I can see the value of the items in the OmniServer diagnostics and also in my client. However, after ~5 seconds it seems like the connection to the server is gone as the item values disappear in the server unless I do another read.

I tested this using UaExpert and after the initial read, the item values persist in OmniServer until I exit UaExpert.

This leads me to believe there is some client parameter I am missing. I found the KeepAliveInterval property that was set to 5 seconds and increased it to 10, but got the same results (also tried the HoldPeriod). Of course, if I do a subscription in EasyOPC the connection obviously persists until I unsubscribe - the problem is just if I do not subscribe and only read the item.

What is the process that EasyOPC goes through when it tries to do an initial read from a UA Server? Is there some other setting I am missing somewhere?

Thank you again for the help. I really appreciate it.

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

Moderators: support
Time to create page: 0.061 seconds