GreenTech

AFConnectionInfo.IsConnected Property ?

Discussion created by GreenTech on Nov 1, 2011
Latest reply on Nov 1, 2011 by cmanhard

Hi Developers,

 

We have a couple of issues with afsdk connections when using an AF collective.

 

Occassionally we get low level socket errors "System.Net.Sockets.SocketException - 'An existing connection was forcibly closed by the remote host';

 

This only happens when connected to an AF collective. The same code on any of the development machines (with either local or remote AF server) doesn't generate these errors so it looks like an AF Collective issue to me.

 

In an effort to test the connection before calling any of the object methods, we test the PiSystem AFConnectionInfo.IsConnected property however we find that this is true even if the connection is down (we can step through the code and after forcibly closing the connection in TCPView, the IsConnected property is still True.)

 

Is this expected behaviour? Is there a better way to check the state of the connection? We have periodically called a 'refresh' but this may have side effects that we don't want'

 

 At this stage the only thing I can think of is to wrap each object method that involves operation on the open connection and trap the inevitable exception that is thrown when there are connection issues.

 

Has anyone else come across this? (or have any other ideas)?

 

Thanks all in advance,

Cheers, Rob

 

Win2k8 svr |  AFExplorer, AFSDK, AFServer 2.3.0.4048 |  VS2008 .Net 3.5 

Outcomes