LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

steps after receiving Datasocket connection error

In CVI, what is the proper procedure when event-based datasockets generate a connection error?

-can you re-use the connection handle somehow to reconnect (with say a timer event) at a later time? Even if you can, is this the best way?
-do you need to discard the failed connection handle and create a new one when you try to connect later?

I'm writing a 'head-less' NT service--no GUI-- but I need to monitor aspects of the data that the service is collecting. Why not datasockets, right? Then the GUI could even be remote!
But I have a bunch of datasocket connections that need to be established. If the first one fails, I don't want to waste any more time attempting connections while my service is starting up. I s
imply want to start a timer to retry later until all connections are made.
My dilemna is how best to react when the first connection fails--so that I don't leak handles, waste memory, resources, etc.

Orlan Franks
0 Kudos
Message 1 of 2
(2,990 Views)
Cosmo,

In my humble opinion, the best way to procede here would be to try to open the connection, if it fails, go ahead and close the DataSocket connection and even shut down the serve (if applicable) and wait for a couple of mins. The you can turn the server back on and retry to open the connection.

I don't see any value on keeping the same DataSocket reference. Specialy if this is a service... The less resources it uses the better.

Hope that helps.

Juan Carlos
N.I.
0 Kudos
Message 2 of 2
(2,990 Views)