Datasocket buffering

I have application1 and application2. Application1 is suppose to send data to application2 through dstp. Application1 acquires data from a NI-DAQ device at 20Hz (20samples/sec). The data is wired to the DataSocket Write. In application2, Data from DataSocket Read is logged into a txt file. It is found that some samples are missing. For example, in one second, the txt file in application2 is supposed to reflect 20 samples/sec, but it only show, say 17 or 18 samples/sec.
I know that this can be done through client or sever buffering, but i do not know exactly how to do it. Pls advise.

Hi DAQmx
You have an example of sending images with Data Socket. You can find that in NI Example Finder, names: DS SendImage and DSReceiveImage.
Anyway, if it is very important not to loose any data, DataSocket may not be the best solution. TCP would work better.
Hope it helps,
Aitortxo.

Similar Messages

  • Difference between Buffered Read and Read Mode on DataSocket Open

    What are the behavior differences when opening a DataSocket connection with a Buffered Read verses Read?

    Mlenz,
    You can learn about buffering data from our website, or in the LabVIEW help.  By using the Datasocket Buffered Read, you are enabling Client-side Buffering.  If you do not use a Buffered Read, then the LabVIEW does not store the values in a buffer, which are written when the value changes.
    Hope this helps,
    TheDillo

  • Datasocket, read when data changed in buffer

    Hai
    I am using datasocket to communicate between a remote VI on the PXI and a server application. Normally i would just write in to the datasocket server from the PXI, but if there is any data in the input buffer i need to read it and process it. Is there any Vi which or way in which i can check for data at input buffer.
    Thanx for the answer

    Hi,
    Plese refer to "LabVIEW Function, VI and How-to help" and search for "datasocket, buffering data". Here you will find a snapshot of a VI that reads data from an Input buffer and also monitors how much buffer is being utilised.
    Please let me know if you have more questions on this issue.
    Regards,
    Ankita A.
    NAtional Instruments

  • Invincible Read Mode on Toolbar

    I have full control over which icons appear on my toolbar. All of them, that is except the 'Read Mode' button. I cannot remove it.
    Unfortunately, I seem to keep clicking this button unintentionally and would like to remove it. I don't use read mode much, and if I do want it, it's still in the Tools menu.
    Am I missing something, or can I not remove this button as I can all the others?
    Adobe Reader X (10.0.1) on Windows XP

    Mlenz,
    You can learn about buffering data from our website, or in the LabVIEW help.  By using the Datasocket Buffered Read, you are enabling Client-side Buffering.  If you do not use a Buffered Read, then the LabVIEW does not store the values in a buffer, which are written when the value changes.
    Hope this helps,
    TheDillo

  • DataSocket PSP Data Buffering

    I have a VI that writes to a network shared variable using DataSocket.  The DataSocket URL uses PSP.  I have another VI that reads the network shared variable also using DataSocket.  I am experimenting with data buffering to see when data is lost if the Writer VI writes faster than the Reader VI.  Is data buffered using DataSocket with PSP in the URL?  If not, I expect data will be lost.  If it is buffered, I don't expect data to be lost until the buffer is full or overflows. 
    Attached is a project with the network shared variables and the Writer and Reader VI.  VIs compare reading and writing directly using a shared variable node and using DataSocket.  With DataSocket, I am experiencing data loss as if there is no buffering.  When using the shared variable node, I do not see data loss.  Run the Reader.vi.  It will read two network shared variables every two seconds.  One variable is read using DataSocket and one is read using a variable node.  Next, run the Writer.vi.  It will write to two network shared variables every 0.5 seconds.  One variable is written using DataSocket and one is written using a variable node.  Since the Writer VI is writing four times as fast as the Reader VI data will need to be buffered to avoid data loss.  Monitor the Buffered Sequence and BufferedDS Sequence front panel indicators in the Reader VI.  Buffered Sequence is data from the variable node.  BufferedDS Sequence is data from the DataSocket Read.
    Solved!
    Go to Solution.
    Attachments:
    Net Share Var & DataSocket.zip ‏49 KB

    Does PSP in the DataSocket URL change the data buffering?  Attached is a page from 'LabVIEW 8.5.1 help/fundamentals/networking in LabVIEW/concepts/choosing among LabVIEW communication features' mentioning lossless data transmission for DataSocket with psp protocol(2nd row in table).  Does lossless data indicate one packet will be guarantied to be sent from the writer and received by the reader; or, does it provide the guaranty with additional packets buffered?
    Attachments:
    LabVIEW Communication Features.pdf ‏61 KB

  • Use buffering and psp with datasocket-VIs and without any binding and shared variable node

    Hello,
    I'm using LV 8.5.
    I'm trying to develop a multiplatform (windows and mac os x) and multi-computer application. II want to get executables running on each device, communicating through the network. Communication process includes datas (such as images) and events messages (something like "Hello, I got an error" or "youyou, my work is done" or "I'm hereeeee!!!!...."). I do need a communication without any loss of data.
    I worked a lot and wanted to test a psp-based design, without any binding nor shared variable node (mac os...) using data socket VIs and SVE buffering.
    I managed to :
    - deploy shared variable library dynamically (even in an executable)
    - communicate between two PCs with datasocket VIs
    However, I never managed to enjoy buffering (even locally with one VI doing the deployment and writing datas and another one for reading).
    I worked hard (dynamic buffering setting, dynamic buffering watching like in  http://zone.ni.com/reference/en-XX/help/371361D-01/lvconcepts/buffering_data/ and in the example "DS send image" and "DS receive image" in the labview examples, trying to use "?sync=true" in the URL, etc...) but no way to get things work.
    I attached a jpeg of an example of receiver and sender. I use wait commands in both receiver and sender to test buffering
    Receiver do receive datas (the last written) but buffering doesn't work.
    Did somebody did that before ? (better than me...)
    Thanks
    Bo
    Attachments:
    Sender.JPG ‏87 KB
    Receiver.JPG ‏96 KB

    Hello,
    Indeed my problem has been solved. My error : in the While loop of the receiver VI, I always reactualize the PacketsMaxBuffer and OctetsMawBuffer parameters, what resets the buffer and make it appears ineffective.
    I now set  the PacketsMaxBuffer and OctetsMawBuffer values only once at the begining of the VI and the psp buffering works perfectly.
    Sorry for the desagreement...
    Bo

  • Shared Variable Engine Buffering Enable/Disable

    Hello -
    I am running into a problem where I am seeing a read of data that seems to be lagging the writing of the data. The reading and writing functions are utilizing the same shared variable - a control to write to it and an indictor to display it somewhere else. The indicator is lagging by one value, ie. scrolling up the value from 1,2,3,4.. will yeild in a display of 0,1,2,3, lagging by one. I am writing/reading to/from a value in a PLC using an OPC server, binding the variables to the control/indicator.
    I am assuming it is the buffering which is causing this, but I can not seem to find where the buffering is enabled/disabled.
    Has anyone seen this behaviour before? Also, where do you configure the Shared Variable Engine to disable buffering?
    Thank you in advance for your help -
    John
    PS> One other note, Datasocket binding of the control/indicator does not yield any problems.

    John,
    Buffering is configured in the main window of the shared variable (double click on the shared variable in the project).  Also, you will see this behavior if you have the RT FIFO enabled and you're using the variable on a Real Time target. 
    I would also recommend taking a look at this white paper which covers the workings of the shared variable:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/5b4c3cc1b2ad10ba862570f2007569ef
    --Paul Mandeltort
    Automotive and Industrial Communications Product Marketing

  • How the heck does datasocket work?

    I've been playing with the example vis DSReader & DSWriter, and reading docs all weekend.  The only way DSreader finds the data from the DSWriter (on another machine on the network) is if I give the reader the IP of the writer machine.  dstp//localhost/wave works when both apps are on the same machine but there's no network traffic at all according to ethereal whether the apps are on the same machine or not.  I thought, from what I read, was that any machne could find the data through the URL, but no.  I want multiple machines to broadcast and receive and all share the data.  The docs say this will work but I really can't see how from the examples.  I have been using the UDP functions for years with no problems but I can't make this work even per the documentation.   What am I missing?  Love Labview, not happy with this.
    Thanks, 
    Andy Bradley
    EBC Electronics Corp.

    Andy,
    communicating locally using TCP or UDP do not create networktraffic. This is because the data is never really sent out in the network. Only the IO buffers are used. So the connection should show up if you use something like a network sniffer. Even the DOS-prompt command netstat shows the datasocket-connection on port 3015 (dstp).
    So the only thing you have to make sure if using dstp in a network (so not only local) is that the dstp-port (3015 by default) is not blocked by any firewall or used by another application.
    hope this helps,
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • "Buffer Utilization" in DataSocket Connections ?

    I am setting up a test situation using DataSockets.
    It will eventually be used between a host, and an RT board, but for right now, it's all in one VI.
    I use DS Open, DS Write, DS Read, and DS Close.
    I want the connection to buffer my data, as the two ends will run anynchronously.
    The URL I use is:
    dstp://localhost/XXX
    Here's the sequence of events:
    DS OPEN (BufferedReadWrite) (the sender end)
    PROPERTY Write(BufferMaxBytes=1024, BufferMaxPackets=10)
    DS OPEN(Buffered Read) { the receiving end }
    PROPERTY Write(BufferMaxBytes=1024, BufferMaxPackets=10)
    DS WRITE(Sender, 1)
    DS WRITE(Sender, 2)
    DS WRITE(Sender, 3)
    DS WRITE(Sender, 4)
    DS WRITE(Sender, 5)
    DS READ (Rcvr) ==> Display 1
    DS READ (Rcvr) ==> Display 2
    DS READ (Rcvr) ==> Display 3
    DS READ (Rcvr) ==> Display 4
    DS READ (Rcvr) ==> Display 5
    DS CLOSE (Sender)
    DS CLOSE (RCVR)
    So that's the basic sequence. If I set the MAX PACKETS property down to 4 or 3, I get only the latest 4 or 3 values, as expected. Fine.
    But I would like to use the BUFFER UTILIZATION property to tell from the sending end whether the buffer is nearly full or not.
    PROBLEM 1:
    The BUFFER UTIL(Bytes) property does NOT report a number of bytes, but apparently a fraction of the MAX BYTES I specified.
    PROBLEM 2:
    The BUFFER UTIL(Packets) property does NOT report a number of packets, but apparently a fraction of the MAX PACKETS I specified.
    PROBLEM 3:
    No matter where in the sending chain I put a property node to read the buffer utilization, it always reports 1/N for the packet utilization, where N is the MAX PACKETS I gave it. If I set MAX PACKETS to 10, it reports 0.1 after opening, 0.1 after the first write, 0.1 after the 2nd write, and 0.1 after the last write. It doesn't matter if I overflow the thing or not.
    PROBLEM 4:
    If I put a property node in the receiving chain, I get weird answers, as well. with MAX PACKETS = 0, I get 0.4 after the 1st read, 0.3 after the 2nd, 0.2 after the 3rd, and 0.1 after the 4th. Fine.
    But I get 0.1 after the FIFTH read (the buffer should be empty).
    And I get 0.1 before the FIRST read (the buffer should be half full).
    The Utilization in bytes is similarly useless.
    Anybody know what I'm missing?
    Why isn't this property more meaningful?
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

    I did figure out some things about this:
    #1 - #2: You can set two limits on the buffer size - if you set a limit of 10 packets, then even a megabyte buffer is full at 10 packets. If you set a limit of 100 bytes, then even a million-packet buffer is full at 100 bytes. So you can look at the "fullness" in either terms, depending on what you need to do. That's contrary to what I was expecting from the terminology, but I understand it now.
    #3: Deep down in the help text, I found out that the property only works from the READ end. After thinking for a while about it, this too makes sense, since the READ end might be very distant from the WRITE end, so for the WRITE end to know about the status of the READ end would require lots of feedback. That
    means lots of reverse net traffic in some cases (not in mine).
    #4: the statement "And I get 0.1 before the FIRST read (the buffer should be half full)." was in error. When I verified the timing of things, the first status report did indeed indicate a 0.5, not 0.1. My bad.
    #4: WILD GUESS: the never-going-below 1 sample problem is actually indicative of the fact that the DS READ operation will return a value every time (after the first one). If there is no new value, it will return the last value it read some previous call. That messes up the actual counting of values in the buffer, but there it is.
    I ended up reporting the buffer status from the READ end back to the caller (along with other results going back), and letting the WRITE end use that number to judge whether it should write more data or not.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Datasocket and Shared Variables

    I am curious if there is any advantage to using Datasocket to read/write shared variables (as opposed to a direct read/write).  I'm specifically talking networked shared variables here.
    Is there any speed advantage to accessing shared variables thru the Datasocket functions?  Since both a direct read/write and a Datasocket PSP read/write talk to the same variable engine I assume they are equally efficient but I'm looking for confirmation here.  I've seen benchmarks for shared variable performance but none of them use DS/PSP to access the variables.
    Normally I would not even think of using Datasocket to access shared var's but where I currently work we have a large app that does this and it works great.  I suspect that this functionality only exists in LV8.x for backward compatibility and non-Windows OS compatibility and is not really meant to be used for new, Windows-based apps?   Am I off base on this?
    I am working in LV 8.5, BTW.....

    Hello Jared,
    Thank you for the reply with clarification. 
    Based on your comment, I changed the buffer parameters and also tried the programs with two different data types, previously StringArray and now String.
    In the attached LV8.6 project, you have all the programs, and shared variable library to review my tests. 
    There are two sets of two files - each set has a Write Shared Variable and Read Shared Variable file. One set is for StringArray type Shared Variable (named StrArr in the library), and the other set is for String type Shared Variable (named Str in the library).
    String Array example:
    MultipleDS-Write-SharedV-StrArr.vi / MultipleDS-Read-SharedV-StrArr.vi
    In my String Array shared variable, I use only 4 element array, each having 4 character strings - meaning 16 bytes per String Array data. I have two loops in the write file, writing to the same variable, an array of 4 strings, each loop continues until the loop index is >0. This means, sometimes, depending on the processor speed, the variable will be written 3 times or 4 times (the variable could have a new value before the loop condition is checked).
    So this means, if I have buffer of 100 bytes (16*4=64<100), it's enough for 4 such arrays (of 4 elements, each element with 4 characters) could be buffered to have sufficient time at the client (Read) program to read them. 
    I am putting 2048 bytes in buffer, which is much more than sufficient in my case. 
    The writer loops run with 200 ms to wait for each iteration. The reader loop runs with 100 ms in DS timeout and 100 ms in wait timer. This gives results without any loss. However, if I run the reader loop with 1000 ms to wait for each iteration, the data is lost. The buffer is not maintained for 2048 bytes.
    In the read program, just to make sure if all data is read or not, I am showing data in two different string indicators, showing data of each loop.
    String example:
    MultipleDS-Write-SharedV-Str.vi / MultipleDS-Read-SharedV-Str.vi 
    The String Array shared variable didn't show values in the Distributed System Manager. Hence, I created another simple variable with String datatype.
    The writer program writes strings of 4 characters, one-by-one, in two loops. Meaning, total 8 strings of 4 characters each are written in the "Str" Shared variable. 
    The reader program, however, doesn't always display all the 8 strings. Although the wait timer is not high (slow) it still misses some data usually. Data is overwritten even before the buffer is filled (in buffer, I have defined 50 strings with 4 elements in each).
    In both of the Read programs, I read using datasocket. I think thought datasocket has more ability to buffer. Earlier I had "BufferedRead" in DataSocket, which I have changed to just Read, because BufferedRead didn't give any special buffer advantage in the Shared Variable reading.
    ---- This is an update on the issue. 
    Ok, just while typing the last paragraph above, regarding datasocket, something clicked in my mind, and I changed the DataSocket functions to simple Shared variables (completely eliminating datasocket functions) in the read programs as well. And bingo, the buffer works as expected, even if I have reading loops very very slow, there is no data loss in any of the program sets. 
    The two changed Read programs are also included in the attached project - MultipleSV-Read-SharedV-Str.vi and MultipleSV-Read-SharedV-StrArr.vi
    So this means, I can completely eliminate DataSockets (not even using PSP URLs in DataSocket Open/Read functions) from my programs. 
    One question here, what will be an advantage of this (or any side effects that I should be keeping in mind)?
    Vaibhav
    Attachments:
    DataSocket.zip ‏71 KB

  • How to open the file when i get it using Datasocket?

    I get a file using datasocket,for example ,a bmp file.but How can i
    open it on my computer? It just save in some buffers.
    please explain in details.
    Thanks in advance.

    You need to convert the image file to a 2D array then transport the array via datasocket.
    Take a look at this example program:
    Convert Image to Array
    Ray K
    Applications Engineer

  • How do i display an image onthe front panel...without buffering ? (dsd format...)

    Hello all...
    i have got to the DS Send Image.vi and i see that i can send an image
    and receive it too..but the catch is that the data is in a "dsd"
    format. any idea how i could get to this format, or what am i doing
    wrong and is it that i dont really need this format?
    i see that there are a few Read/Write JPEG file.vi's too but they have
    proved of little use to me.
    could anybody throw some light on this please...
    thank you,
    -U

    If you are not using buffered datasocket, sending the picture is just like sending any complex data like an array. Have you tried just removing the buffering part of the example?
    The dsd (datasocket data file) is an NI datatype and there are no documents on the format for this file type.

  • Buffered Downloading of a File using a URL

    Hi All,
    I have been trying to download a file (online - using URL) using the Data Socket Read. But on downloading the file (Minimum Size: 250 MB) the labview memory gets built up i.e I will have to wait till all the packets pertaining to that file are received by the client. I tried using buffered read in Data Socket Open, so that i would to able to obtain instantaneous packets received. But still the memory builds up during the download process. Can anyone please suggest me a solution so that i would be able to obtain the packets as and when they are received by the client instead of waiting for the entire file to be received by the client ?
    The data downloaded will be in unformatted text and i have attached the VI for reference. Thanks in advance.
    Regards,
    S.P.Prasaanth

    If you are keeping the file in memory as you are downloading it then it will of course use lots of memory (essentially an array of bytes). I think the key thing here is to periodically flush the chunks data received to disk.
    I don't know if this is possible using the DataSocket functions (it maybe buffers the network data, not the file part?) but it should be possible using the raw TCP/IP functions or perhaps even a .NET library (HttpWebRequest?).
    Edit: On looking at your VI, I can't see any obvious cause for the whole file to be in memory unless it's something relating to how DataSockets are implemented internally. In which case - my point still stands that you could try the .NET library or doing the http by raw TCP/IP.

  • Datasocket ActiveX problem

    I have an issue with the standard Datasocket VI's that come with Labview 8.2.1. Datasocket has an ActiveX component which should theoretically act the same as the canned VI's. I wanted to test the ActiveX functionality so that a fellow programmer could pass/receive data from my Labview program into his Visual C++ program. I will use the Datasocket Read/Write vi's and he could use the ActiveX components in C++.
    I'm using the 'DS 3D Graph Reader.vi' and 'DS 3D Graph Writer.vi' from the examples as the base to test out ActiveX. I spent most of a day trying to get the reader portion to read the standard output of the Writer. I kept ending up with an array of the correct size with all zeros instead of the data. If I switched the reader back to the canned vi, it worked fine. No matter how I configured the ActiveX settings, I could not read the data.
    Then I modified the Writer to use ActiveX to write data to the server instead of the Datasocket Write vi. Once I did this, I can read the data using either ActiveX or the standard Datasocket Read vi.
    What I can't figure out is why the write portion makes a difference. This is my first time using Datasocket, but not ActiveX, which I've used to communicate with Windows components and devices many times in the past. The documentation included with the Datasocket ActiveX is pretty sketchy and missing several settings which are available (the Sync settings and the Buffered settings).
    I've attached the vi's I modified to try out. Make sure to start the Writer first.
    Thanks in advance!
    Tom
    Attachments:
    DS 3D Graph Reader.vi ‏54 KB
    DS 3D Graph Writer.vi ‏49 KB

    Thanks, guys.
    No joy, unfortunately.
    I tried 'Datasocket Open' outside the loop and then closing it when quitting, but I'm still having the same issue: an ActiveX read cannot see the data, but a DS Read can.
    I've attached the new 'DS 3D Graph Writer' vi and the 2 subvi's, though Labview should have been able to find them - they're from the standard example vi.
    I don't see how to configure the Datasocket Server. Diagnostics lets me see the 3dgraph folder with the 'data' item in it, but not modify it's characteristics in any way.
    Any other suggestions?
    Attachments:
    DS 3D Graph Writer.vi ‏52 KB
    create waveform.vi ‏30 KB
    Launch DS Server if Local URL.vi ‏30 KB

  • Trouble with sending huge arrays via DataSocket​s.

    Hi,
    I am having trouble sending huge arrays via Data Sockets from my main vi on the server PC to the vi on the client PC.
    To further elaborate, in my main vi program I have created 3 arrays called Array1, Array2 and Array3 on my front Panel. By right clicking the mouse on each set of array and from the pop-up menu I selected Data Operations-> DataSocket Connection and I entered dstp://localhost/Array1 and clicked on Publish to broadcast the data from Array1. Similarly, I did the same for Array2 and Array3.
    Now, in my client vi program I have created three arrays on my front Panel to read (Subscribe) the data from the three arrays broadcasted via DataSockets from the server’s main vi program. To subsc
    ribe the data I did the similar process above and clicked on Subscribe to read the data (of course the IP address of the client PC will be different then the server PC so enter the hosts IP address). Once the data is received in the client arrays, I am using LV2 globals so that I can use these arrays on other sub-vi’s locally (instead of having each sub-vi get data from the server directly).
    I succeeded in doing this with two arrays, however when I added the third array the DataSockets would not work consistently. For example the refresh rate would get slower at times and sometimes 2 out of the 3 arrays would update. I don’t know if I have exceeded the limit on how much data DataSockets can broadcast, but I need to have some mechanism to broadcast 6 arrays (approx. 10000 elements for each array) of double digits precision.
    Has anyone come across this issue? Is there another way of broadcasting data more efficiently then DataSockets?
    I would appreciate any
    help that I can get.
    I have attached the files for this program in the zip file.
    First run the Server main program, testServeMainVI.vi, and then the client program, testClientMainVI.vi.
    Thanks
    Nish
    Attachments:
    beta2.zip ‏70 KB

    DataSocket can be a lossy communication. I like the advice to flatten the data to a string, but another option would be to buffer the communcation. The problem might be that the data is being overwritten on the server faster than it is being read. There is an example of buffered datasocket on NI web page: http://venus.ni.com/stage/we/niepd_web_display.DIS​PLAY_EPD4?p_guid=BA3F9DFED17F62C3E034080020E74861&​p_node=DZ52000_US&p_submitted=N&p_rank=&p_answer=&​p_source=Internal
    Also, I have played with the new built in buffered datasocket in LabVIEW 7.0. It is pretty slick. If buffers the data both on the server and the client side.

Maybe you are looking for

  • How do i change my ipod touch permanently from one apple id account to a new one

    How do i permanently change my ipod touch from one apple id to a new one with my new ipad and have the same apps etc on both. Thanks.

  • Special GL Indicator for security deposits

    Dear All:                I want to make security deposits to vendors through F-48. Please guide how do we define special GL indicator fo this booking secuirty deposits to vendors. Regards

  • Need Help .... (JNI)

    Dear Well, i try to learn about JNI so i try stegostick, u can get stegostick at http://sourceforge.net/projects/stegostick i can understand this application until this problem appear T_T Java interface and C++ library have done and i try to call lib

  • T500 screen dilema: WXGA TFT, LED vs WSXGA+ TFT, CCFL

    Hi guys, planning to buy a T500 in the next few days and I want the best screen possible. In the UK these are the two best options, the price difference is small. I know the benefits of LED screens and that the WSXGA+ has higher resolution but since

  • Restore incremental backup with rman

    Dear Friends can u tell me how to restore an incremental backup with rman? i backup my rman with statement below : 1. backup full database format '/oracle/PRD/sapbackup/%U'; the results was : -rw-r----- 1 oraprd dba 19006996480 Jun 10 12:08 0ojiit4n_