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.

× If you are developing in .NET, but are using the OPC-UA (OPC Unified Architecture), please post in the QuickOPC-UA category instead.

Server Connection

More
10 Jul 2024 12:09 #12936 by Jannie@Moore
Replied by Jannie@Moore on topic Server Connection
Hi, thank you , i think all these makes sense. Thank you for assisting

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

More
10 Jul 2024 11:45 #12935 by support
Replied by support on topic Server Connection
Hello.

There are important things to know and keep in mind:
- In QuickOPC, each item subscription is treated as a separate data stream with its own error reporting. If there is a server-wide problem, all subscribed items receive the corresponding error notification.
- Notifications are coming sequentially, but they are queued internally. So, if a notification already exists, QuickOPC will deliver it, you cannot cancel it.
- calls to SubscribeXXXX, UnsubscribeXXXX or ChangexXXXSubscription are all asynchronous. The actual operation may take place after the method call returns. This means that also notification may come for some time, even after you call UnsubscribeXXXX.

If you are trying to reconnect to the same server: Do not do it. QuickOPC has robust reconnection mechanisms of its own, and trying to interfere with them is going to so more harm than good. If you are not happy with the built-in reconnection mechanism, explain why.

If you are trying to fail over to some different server: You can unsubscribe from the currently subscribed items, but keep in mind that the fact that outstanding notifications will still come, as explained above. It is possible to ignore the notification that you do not want by coding around it.

Regards

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

More
10 Jul 2024 05:49 #12931 by Jannie@Moore
Replied by Jannie@Moore on topic Server Connection
Hi there is there is connection failer in this method i want to unsubscribe all items and try to subscribe them again. but it doesnt do that. Instead it keeps on firing the exception until it finish looping all the items.

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

More
09 Jul 2024 16:05 #12929 by support
Replied by support on topic Server Connection
Hello.

I do not quite understand what actually is the question. You have already provided code. Are you saying that the code does not work as expected? If so, how is the code's behavior different from the expectation?

Thank you

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

More
09 Jul 2024 13:22 - 09 Jul 2024 15:55 #12928 by Jannie@Moore
Hi There, im trying to handle fail over for opc server connection if server is down i want to switch to the backup. but i want to handle this on the subscription. With AE , there is exception handling when trying to subscribe to an event but with DA and UA is different, I'm failing to catch the server and node connection error while adding subscription. If opc server and node are not available i want to switch to back up before even trying to attempt to read the data. Can you please provide me with an example.

This is where i get the data and handling the connection here is not working , because it check per tag.
private void Client_ItemChanged(object sender, EasyDAItemChangedEventArgs e)
 {
 
     SubscriptionTagStateItem stateItem = (SubscriptionTagStateItem)e.Arguments.State;
     if (e.Succeeded)
     {
         if (e.Vtq != null)
         {
             TagDataItem tag = new TagDataItem()
             {
                 TagID = stateItem.TagID,
                 TimeStamp = (e.Vtq.Timestamp < (DateTime)SqlDateTime.MinValue)
                                    ? (DateTime)SqlDateTime.MinValue
                                    : e.Vtq.TimestampLocal,
                 Quality = e.Vtq.Quality.InternalValue.ToString(),
                 QualityCode = ((int)e.Vtq.Quality.InternalValue).ToString(),
                 Value = e.Vtq.Value.ToString()
             };
 
             UpdateTagData(stateItem, tag);
         }
     }
     else
     {
         //_logger.LogError("[{0}] - DataChangeNotification ({1} *** Type: {2} *** Failure: {2})", DateTime.Now, e.Arguments.ItemDescriptor.NodeId, e.Exception.GetType().ToString(), e.ErrorMessage);
 
         if ((e.Exception is OpcLabs.EasyOpc.Engine.NetApiException || e.Exception is OpcLabs.EasyOpc.Engine.NetApiResultException) && !_restarting)
         {
             _hasShutdown = true;
             _logger.LogWarning("Server has shut down. Needs to restart.");
         }
     }
 
 }
Last edit: 09 Jul 2024 15:55 by support. Reason: For readability

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

Moderators: support
Time to create page: 0.050 seconds