LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI's with datasocket attachments

I have two different VI's running on different machines. I have gotten
the Datasocket server working/configured correctly thanks to some
answers to a previous post. My problem is now that the Datasocket
connection doesn't seem to work right whenever I start the Subscribing
VI first and then the Publishing VI next. Is it a requirement to start
the Publishing VI first and then start the Subscribing VI? By the way,
Datasocket server shows the proper number of connections no matter which
VI I start first.

thanks,
stephen
0 Kudos
Message 1 of 6
(3,455 Views)
Stephen, have a rest. You seem overheated a little bit :).
What do you mean by "work right" if number of connections is normal? Publisher publishes data and subscriber receives data. Depending on DS server properties, subscriber can read data from the predefined item even if publisher is not publishes it yet. To receive data from publisher you should have both parts running. It doesn't matter who will start first. It's a business of your application how to track errors and sequence of running parts of the application. Just check that data is in normal range. There is a property to check if data was updated since last read. Just poll this property to see if the new data came, showing to you publisher connection arrival.
Of course if I'm not missed something.
Sergey
0 Kudos
Message 2 of 6
(3,455 Views)
I'll second on most of the points. The issue could be the "Creator" setting. If you're reading and the item hasn't been created (and the reading computer doesn't have permissions) then you should receive an error. If it does have permissions the data will be garbage or the read will timeout since no data has been writted. So really the read becomes useless until a write has been done.

Kamran
An
0 Kudos
Message 3 of 6
(3,455 Views)
Great! thanks Kamran. Now somebody at NI should care of the application note or appropriate deep explanation document about DS using to prevent us wasting time hacking DS.
Sergey
0 Kudos
Message 4 of 6
(3,455 Views)
Maybe I should explain it a little better 🙂

I have Computer A on which I run Publish.vi. Publish.vi contains only a
numeric control connected to the Datasocket server (via the right
click->Data Operations->DataSocket connection) which runs on Computer
B. I have Computer B which runs Datasocket server and Subscribe.vi.
Subscribe.vi contains only a numeric indicator connected to the
Datasocket server.

If I start Publish.vi and then start Subscribe.vi, the changes I make to
the control on Publish.vi show up on the indicator on Subscribe.vi. The
green LED's on both VI's light up (indicating a good connection?) and
the Datasocket server shows 2 Processes connected. Everything works
GREAT!!!

Now, if I start Subscribe.vi first and then Publish.vi, then chan
ges I
make to the control don't show up on the indicator. The LED on the
indicator on the Subscribe.vi is GREEN and the LED on the control on the
Publish.vi is RED. The Datasocket server shows 2 processes connected.

I hope this makes my problem a little clearer.

thanks for the help,
stephen



SERGEY wrote:
>
> Stephen, have a rest. You seem overheated a little bit :).
> What do you mean by "work right" if number of connections is normal?
> Publisher publishes data and subscriber receives data. Depending on DS
> server properties, subscriber can read data from the predefined item
> even if publisher is not publishes it yet. To receive data from
> publisher you should have both parts running. It doesn't matter who
> will start first. It's a business of your application how to track
> errors and sequence of running parts of the application. Just check
> that data is in normal range. There is a property to check if data was
> updated since last read. Just poll this property to see if
the new
> data came, showing to you publisher connection arrival.
> Of course if I'm not missed something.
0 Kudos
Message 5 of 6
(3,455 Views)
Stephen,

Attached is my trial to reproduce error. No luck.:( The all works in any order.
Try to do the following:
Open DS Server Manager.
Select SampleNum item from predefined data items and set read and write access to SampleGroup.
Then add your hosts to SampleGroup list.
Then connect Publisher numeric to SampleNum item (brosing data from the menu will do) and subscriber to SampleNum item the same way.
Now you will always see GREEN leds on both independently of starting sequence (DS server should be started and settings made in Server Manages should be saved before.)
If troubles try to experiment on localhost for example. In my case it works on any PC connected to the local network.
My samples attached.

Regards,
Sergey
0 Kudos
Message 6 of 6
(3,455 Views)