Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting socket disconnected by peer error

Solved!
Go to solution
Is there a way to detect the "socket disconnected by peer" error for an NV that is only subscribed to? When interacting with an NV (either through a read or write operation) sometimes this error is thrown and in that case can be easily caught, but my interest is in detecting this error for an NV that is not read/written, but only subscribed to.
0 Kudos
Message 1 of 7
(5,881 Views)

Hi Steve,

 

Do you mean that you want the subscriber to be able to know when it's lost the connection to the network variable manager that's hosting the variables?  It sounds like you should be able to get what you want by checking the NetworkVariableDataQualities Enumeration.

Message Edited by EadieU on 06-05-2009 03:37 PM

Mark E.
National Instruments

0 Kudos
Message 2 of 7
(5,868 Views)
I will look into the method you mentioned but I'm actually looking for an event that I can catch, not something I have to manually check. I want to know when a connection to an NV gets broken for any reason and if the underrlying NI infrastructure thows events in this case, that would be my prefered method of getting notified.
0 Kudos
Message 3 of 7
(5,846 Views)
Solution
Accepted by topic author Steve_InMA
I've looked into it further, and the one thing we can offer is the NetworkVariableManager.PropertyChanged Event which is raised by the ConnectionStatus property.  It will be thrown on very basic connection breaks on the local machine, such as the network cable being disconnected from the local machine.  This isn't fully what you want, but it's the closest thing we can offer. 

Mark E.
National Instruments

0 Kudos
Message 4 of 7
(5,836 Views)
Thanks, that answers my question. I will see what NVManager.ChangeEvent has to offer.
0 Kudos
Message 5 of 7
(5,830 Views)
I meant to say the PropertyChanged Event - my bad.

In general, NVs have simplified our job and I'm glad they are available. As a suggestion, one weakness I notice when working with NVs is knowing when the connection to an NV is valid. This is a bigger issue when an app only subscribes to an NV and does not read or write that NV. Our environment is such that network connections can come and go so perhaps NI can (in future releases) include ways to have applications be notified of NV connection problems. Thanks.
0 Kudos
Message 6 of 7
(5,827 Views)
Steve, thank you for that feedback; we take customer feedback very seriously here.  I have filed a product suggestion based on your feedback.  If you would like, I encourage you to also file a suggestion at our Product Suggestion Center

Mark E.
National Instruments

0 Kudos
Message 7 of 7
(5,821 Views)