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.

No notification for disconnect

More
08 Feb 2016 10:26 #3826 by support
Great.

For readers of the forum - always check .Exception in the incoming event arguments or result objects first.

Best regards
The following user(s) said Thank You: giles

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

More
08 Feb 2016 10:17 #3825 by giles
Ah sorry you are right - AttibuteData was null so I was getting a silent exception in my code

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

More
08 Feb 2016 09:57 #3824 by support
In general, the answer is No. You *should* get a notification in such case.

Can you please answer following questions:

1. Which version and build of QuickOPC are you using?
2. Is the server local or remote?
3. Which protocol (opc.tcp:, http: ?)
4. What precisely do you mean by "...the server gets switched off". Is it referring to a loss of power of a remote machine? Or a force termination of the server process? Or a properly shutdown of it? Or a properly shutdown of the whole machine? Etc.
5. How long have you waited after that?
6. Do you test the .Exception of the incoming EasyUAMonitoredItemChangedEventArgs ? Can you post that piece of code here?

Thank you, and best regards
The following user(s) said Thank You: giles

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

More
08 Feb 2016 09:37 #3823 by giles
I am connecting to a kepware server using UAMonitoredItemChangedObservable. I find I don't get notified if the server gets switched off. Is this expected.

For reference I have ended up pinging the server every 60 seconds as below I wonder if there is a better solution you could suggest ? (I realise could use one common tag for the server and channel rather than pinging each tag)
public class ItemValue
    {
        public object Value { get ; set;}
        public bool Good { get;set;}
 
        static public IObservable<ItemValue> UaObservable(object status, string endpoint, string node, int updateInterval, string type)
        {
            var args = new EasyUAMonitoredItemArguments(
                status,
                endpoint,
                node,
                updateInterval
            );
            var uaClient = new EasyUAClient();
 
 
            var check =  (Observable.Return<long>(0).Concat(Observable.Interval(
                TimeSpan.FromSeconds(60))).Select(t =>
                    {
                        try
                        {
                            return uaClient.Read(
                                endpoint,
                                node
                            ).HasGoodStatus;
                        }
                        catch (Exception)
                        {
                            return false;
                        } 
                    }
                ).Distinct());
 
 
            return check.SelectMany(c =>
            {
                if (!c)
                {
                    return Observable.Return(new ItemValue{Good=false});
                }
                else
                {
                    IObservable<EasyUAMonitoredItemChangedEventArgs> ret = null;
                    switch (type)
                    {
                        case "int":
                            ret = UAMonitoredItemChangedObservable.Create<int>(args);
                            break;
                        case "bool":
                            ret = UAMonitoredItemChangedObservable.Create<bool>(args);
                            break;
                        case "double":
                            ret = UAMonitoredItemChangedObservable.Create<double>(args);
                            break;
                        case "float":
                            ret = UAMonitoredItemChangedObservable.Create<Single>(args);
                            break;
                        default:
                            ret = UAMonitoredItemChangedObservable.Create<string>(args);
                            break;
                    }
                    return ret.Select(
                        r => new ItemValue
                        {
                            Value = r.AttributeData != null ? r.AttributeData.Value : null,
                            Good = r.AttributeData != null && r.AttributeData.StatusCode.ToString().StartsWith("Good")
                        }
                    );
                }
            });
 
 
 
        } 
    }

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

Moderators: support
Time to create page: 0.045 seconds