I'm connecting to an OPC-server with datasockets and have a problem when I have more than ~6 open connections.
I use the Datasocket open-, read/write- and close VIs with LabView 7.0. With 6 open connections everything is ok, but when I add a couple more then the whole program freezes randomly (LabView needs to be killed with taskmanager). It is not a problem with a _particular_ OPC-connection, lets say that I have connections to OPC data A,B,C,D,E,F (that's 6 connections) it works. Then I add connections to G and H -> it freezes on some runs. If I then delete (lets say) B and C and have: A,D,E,F,G,H -> it works fine again.
So the program I'm running is of the following sort:
A flat sequence with three frames. In the first frame I open the connections with the DataSocket Open VIs. Error ins and outs are serially connected, so the Open VIs don't execute in parallel. This should be ok? With ~6 opens here the program runs great, but with ~7-8 opens it freezes randomly. I have tried timeouts in the range of 500ms to 40s. When a DataSocket VI freezes (execution highlighted to see where everything goes wrong) there is no timeout. Everything just freezes.
The second frame has a while loop and inside that loop there is code that modifies/reads the contents of the corresponding OPC data connections.
In the last frame I close all the connections with DataSocket close VIs.
Is this a problem with LabView 7.0 DataSocket VIs or is there something wrong with my datasocket usage.. I would require only about 15 open connections, what would be the best choice to subscribe and publish OPC data?
Should I open and close the connections inside the loop on EVERY loop iteration? (which doesn't sound that wise) That way I would not have many connections open at the same time.
And what happens if I DON'T use the DataSocket Open/Close VIs, instead I use the write/read VI straight away (you can specify the URL directly to the read/write VIs and it works, atleast it gives/writes data). Does the write/read VIs automatically close the connection when finished?
Well, any comments or experience with similar problems would be nice.
have you tried to emulate your OPC-Server with some DSTP - Items? By doing so you may be able to find an error inside your App, you just need to change some URLs. I can't imagine a OPC - Server which is unable to serve more than 6 items at the same time, as long as the machine has enough RAM and CPU and there's no problem with the hardware attached to the server.
for the programming its the best to use DataSocket Open/Close Functions before and after the while-loop and DataSocket Read/Write Functions inside the loop. Pass the Connection ID to the Functions, when passing the URL the connection is established and closed at each call inside the loop.
By the way: what kind of OPC-Server do you use? can you post some code?
Best regards chris
CL(A)Dly bending G-Force with LabVIEW
famous last words: "oh my god, it is full of stars!"