LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using labview 6i if a datasocket loses connection with a datasocket server, is there any way to reestablish this connection without restarting the vi?

I noticed with the datasocket read, if I lose a network connection to the datasocket server and then the network connection is reestablished, I still show an error (#66) in the datasocket read.
0 Kudos
Message 1 of 5
(2,596 Views)
The datasocket primitives are not capable of reestablishing a lost connection.

This workaround is only for Windows OS.

If you use the datasocket VIs in LabVIEW 6/vi.lib/platform/dataskt.llb you can programmatically connect/disconnect connections. Using these VIs you could place your reader or writer in an
inner loop and if an error (closed connection) 66 appeared then you would close the connection and then attempt to reconnect in an outer while loop.

Marc Monroe
Application Engineer
National Instruments
0 Kudos
Message 2 of 5
(2,596 Views)
Jeff,

I have tried to do as you say, but when I shut down the datasocket server, I do get any error message from the data socket read (in the inner loop) other than code 30301 "Datasocket Read Variant Vi Timeout". Do you have any sample code demonstrating how to do this? Maybe I will see what I am doing wrong. Thanks.
0 Kudos
Message 3 of 5
(2,596 Views)
I am having what I think is a related problem. I am running the datasocket server, writer VI and reader VIs on a switched subnet in Germany the reader VIs in Scotland. There is no data loss between reader and writer if both VIs are run in Germany but the reader loses connection to the datasocket server after about 7 hours continuous connection when I try to run it in Scotland. It displays the error code 30301. I have tried doing as Jeff M. suggested (didn't work) and also tried a knowledge base suggestion to temporarily reconnect to the datasocket server with a blank URL (reconnect.vi). This also didn't work. The only solution I have found is to stop and restart the entire VI. I think that there is a clue in the fact that I do not see this problem
when trying to run the reader and writer within the same subnet but only when I separate them on to different subnets. It's as if a buffer somewhere is overflowing after 7 hours and stopping the connection. By restarting the VI, the buffer is cleared and data continues to arrive. It might be that the number of TCP/IP packet collisions is much higher when the reader and writer VIs are on different subnets and this is why the 'buffer' overflows. I am at a loss as to how to test this theory or fix the problem so any suggestions or information is welcome!
0 Kudos
Message 4 of 5
(2,596 Views)
The only way I have found to reestablish a connection is to use the old datasocket controls from an earlier version of labview than 6i and within a loop countinually check if the DS Status is not equal to 2. If it is not equal to 2 then close the datasocket connection fall back to the orignal while loop which established the connection and open this connection again.
0 Kudos
Message 5 of 5
(2,596 Views)