LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what is the difference between wiring a datasocket reference or a datasocket URL into Datasocket Read and Write VIs?

Which is better? To wire a URL or a reference into Datasocket read/write?

Does wiring in the reference save processor effort/time? Do I have to close the DS reference before I can do other things to either the same DS connection or other connections? The examples I have looked at tend to use URL's, why is this?

(I am running Labview 7.0 on Windows 2000)
0 Kudos
Message 1 of 11
(4,723 Views)
The reference normally requires a valid connection was already made, therefore there is no need to re-open the socket again. Normally we open a datasocket connection once, and use that connection as needed, then close the connection when application exits.

I've never used URL for DS Read or DS Write, so I don't know the goodies about them. But I guess the connection is re-opened every time.

-Joe
0 Kudos
Message 2 of 11
(4,724 Views)
John,

Thank you for contacting National Instruments.

To answer your first question, whether it is better to wire a URL or reference into a DataSocket Read/Write depends on your application. When you are going to be writing or reading multiple times to the same connection (such as using a loop), it is more efficient to first open a DataSocket connection before the loop, pass a reference to your write/read functions within the loop, and then close the connection after the loop. Using only a DataSocket Read/Write will cause your connection to open and close each time the loop repeats. This can significantly increase the load on your processor and system resources.

LabVIEW will allow you to supply a URL directly to a DataSocket Read/Write, which is useful
if you are only going to be making one read or write.

You can open multiple DataSocket connections simultaneously using DataSocket Open. It is recommended, however, that you close every connection once you have finished performing the necessary tasks for that connection. I believe you can perform both read and write functions to the same connection before closing it if you wire a �ReadWrite� constant to the �mode� connector of the DataSocket Open VI.

I hope this helps!

Matthew C
Applications Engineer
National Instruments
0 Kudos
Message 3 of 11
(4,725 Views)
I attempted to use datasocket references with Labview 7.1 and Windows XP, but found that the writes did not always happen (even though I did not get an error and had mode set to read/write). When I changed the writes to be driven from a URL string, they worked fine. I left the open, close and reads running off the reference. I have not been able to figure out what causes this behavior. What started all this was my upgrade from LV6.1 to LV7.1. The datasockets worked fine in 6.1, but have been unreliable in 7.1 (just recompiling the same code).
0 Kudos
Message 4 of 11
(4,725 Views)
I'd like to bring this thread back up because I'm having the same issue as Michael here.....

I'm stumped on a the functionality of the Read/Write mode for the Datasockets Open VI.
I've attached a picture below showing the 2 different methods of opening Datasocket references....In one case, I use the Read/Write mode for DS open, in the other case, I use 2 DS opens: One for READ and another for WRITE. For some reason, only the latter program works properly (when I open READ and WRITE separately). Why is this?

I thought that if the READ/WRITE MODE was used, the output reference can be used with the Datasocket READ and Datasocket WRITE Vi's as shown in Top Vi of picture. Instead, It seems I'm unable to "change" the state of the Datasocket tag using the the Top Vi.


FYI: I'm using DS server manager to create the item. I've also gave proper privileges to each computer so that they can communicate with the DS server. It obviously works since using the bottom VI, I get the desired results.

What am i doing wrong?  Are my expectations for the Rea/dWrite functionality correct?




Message Edited by RegisPhilbin on 07-15-2005 11:11 AM

0 Kudos
Message 5 of 11
(4,641 Views)
Hello,
 
I was not able to see the picture linked in your post. Would it be possible to attach the image to the post instead of linking to it on an outside side?
 
I am not sure why the dataitem would not update. Is there any type of error indicated by the error cluster output of the datasocket VIs?
 
Scott Y
NI
0 Kudos
Message 6 of 11
(4,620 Views)
Here is the picture attachment of the problem I had....and no,  There were no error messages.  When running in Highlight execution mode,  both Read and Write Vi's were processed without issues.  It's just that the "write" functionality doesn't seem to work.....

Regis

Message Edited by RegisPhilbin on 07-18-2005 01:26 PM

0 Kudos
Message 7 of 11
(4,616 Views)
I've clarified the problem and put together an example vi here: 


LAVA Discussion Forums

Message Edited by RegisPhilbin on 07-19-2005 05:14 PM

0 Kudos
Message 8 of 11
(4,603 Views)
Hi,
 
Have you tried using the older datasocket VIs to see if they behave the same way?
 
They can be found in the following library:
 
C:\Program Files\National Instruments\LabVIEW 7.1\vi.lib\platform\dataskt.llb
 
Scott Y
NI
0 Kudos
Message 9 of 11
(4,572 Views)
Scott,

the "old" datasocket VI has separate "read" and "write" modes which (i think) mean that you need to have 2 DS Open's as well inorder to read and write to the datasocket item,  thus its no different in how it would work compared to the new primitives....

Can someone please inform me how I should use the "readwrite" mode with the Datasocket Open VI?    What is the capability of the "readwrite" mode vs "read" or "write" mode?  There is very little documentation in the LV help.....

Reg

Message Edited by RegisPhilbin on 07-20-2005 03:32 PM

0 Kudos
Message 10 of 11
(4,574 Views)