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.

Client disconnect

More
18 Oct 2022 07:06 #11157 by support
Replied by support on topic Client disconnect
Hello,

please make sure you have read these:
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...tml#Connection%20handling.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...tion%20Control%20Services.html

Basically, I think that what happens under the hood is somewhat different from what you have assumed.

With default settings, unless the connection is "held" by a subscription, QuickOPC will disconnect after some time when it is not needed. If you code just the Read e.g. in context of serving a Web request, then the connection will be kept open when the Read-s are coming quickly enough in succession (less than 5 seconds or so in between). When there is a longer delay, QuickOPC disconnects. And it will then re-connect automatically when a new Read is requested.

The disconnections are normal. What is happening there is that probably some re-connections fail with BadUserAccessDenied. So, in my estimation, most likely, BadUserAccessDenied is not *causing* any disconnection. Instead, it is an error that the server gives upon some re-connections.

QuickOPC normally only uses one connection to any target server. It rare circumstances, usually with network disruptions, the server may see more than once connection from the client while the client thinks it only has one connection. This cannot be prevented.

The proper way of resolving this would be to figure why the server is giving BadUserAccessDenied, and fix it. Eveyrthing else are just workarounds.

If you wanted to cause "quicker" disconnection after a Read, you could set the EasyUAClientConfiguration.SessionParameters.AdaptableParameters.HoldPeriod to a low value. But, in my view, if you wanted to work around the issue, you actually need to *prevent* disconnections, by setting this property to a *high* value. Alternatively, the connection locking can be used (see the documentation), or roughly the same effect can be achieved by setting up an OPC UA subscription to any (even non-existent) node and keeping it subscribed.

Regards

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

More
17 Oct 2022 11:51 #11156 by novotnypetr
Hello,
we use QuickOPC library for communication with injection moulding machines via PHP and COM. Sometimes we have problems with reconnection to the machine (error BadUserAccessDenied) and we must restart the machine. After machine restart communication works again.
Maybe the problem is in unclosed session which is blocking new connections.
Is it possible to disconnect or end client session on client side? I couldn't find any example or mention in the documentation.

Our PHP code:
 
//Instantiate the client object
$opcUaClient = new \COM("OpcLabs.EasyOpc.UA.EasyUAClient");
 
//session settings
$opcUaClient->Isolated = TRUE;
$opcUaClient->IsolatedParameters->SessionParameters->EndpointSelectionTimeout = 3000
$opcUaClient->IsolatedParameters->SessionParameters->SessionConnectTimeout = 6000;
$opcUaClient->IsolatedParameters->SessionParameters->SessionTimeout = 6000;
$opcUaClient->IsolatedParameters->SessionParameters->SessionTimeoutDebug = 6000;
$opcUaClient->IsolatedParameters->SessionParameters->UserIdentity->UserNameTokenInfo->UserName = 'username';
$opcUaClient->IsolatedParameters->SessionParameters->UserIdentity->UserNameTokenInfo->Password = 'password';
 
//calling some method
$results = $opcUaClient->ReadMultipleValues($arguments);
 
//and now how to close session ? Is it possible?
//for example: $opcUaClient->closeSession();
 


Thanks for your help.

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

Moderators: support
Time to create page: 0.076 seconds