LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reconneecting to DataSocket Server

Hi all am using DataSocket Open vi to open the connection and then using DataSocket read VI to read from that connection, I have several such connection in my VI. when i restart DataSocket server, some of the connection are reestablished but some are not. Can any one tell me why does this happen? also i saw a knowledge base for reconnecting the datasocket server it can be used only if am using only DataSocket Read VI with out using the DataSocket Open VI, but i guess using only DS read VI will open the connection every time i read from the dataitem. Please give me input on this
 
regards
Arun 
0 Kudos
Message 1 of 3
(2,816 Views)

I was unable to reproduce your issue using the explicit DataSocket Open VI's in conjunction with DataSocket Read and Write. I had two VI's, one writer and one reader, and they both open a connection, and then read or write in a loop. I was able to run the VI's, shut down the DataSocket server, and then restart the server, and have the VI's resume where they left off. In short, the DataSocket Read and Write VI's are able to reconnect after the DataSocket Server is restarted, even if they are explicitly opened before the loop using a DataSocket Open VI.

You mentioned that some of your connections were re-established, but not others. What is the qualitative difference between the two? Are some of these connections perhaps timing out before you restart the server?

Jarrod S.
National Instruments
0 Kudos
Message 2 of 3
(2,798 Views)

Jarrod S. wrote:

 

Are some of these connections perhaps timing out before you restart the server?


And (if so)?

 

If the connection times out or if the datasocket read/write produces an error (due to connection loss for e.g.), and after "some" time (which is more than the time out, i.e. timed out too) if we restart the datasocket server, will it or will it not resume the same connection? I "used" string as datasocket connection name, and passed it in each datasocket read/write (so that I don't have to wire everywhere) and I'm now using ConnectionIDs instead of string (of the connection names) so if I restart datasocket server after a connection is lost, do I need to Re-open to reconnect or I can continue with the same connection id?

 

If I had connection strings in DS Read/Write nodes, it would (if necessary) open the connections first, but I thought the Connectin ID is something that is volatile (stays valid only for one life). If I am passing connectionID variables to DSRead/Write node and if the connection is reestablished at remote datasocket server, but not necessarily DS Opened in this VI, should it or should not it resume the "same" connections?

 

I thought it shouldn't. But to my surprise, it DOES.

 

I came to this thread in search of some answer, and while writing this response, I continued my experiment and it changed my belief. I started connections, then at one point I tried to write something to the DS address, after shutting down the server, and it gave an error naturally, which I handled and showed a message if the user wants to continue, and after 15 seconds (time out = 10 secs) I restarted DS server, and instantly it showed all those connections I had before I shut down, and I tried to write that data again (using ConnectionID) and it said OK in the Error Out.

Vaibhav
0 Kudos
Message 3 of 3
(2,496 Views)