"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

Similar Messages

  • Datasocket connection failure requires restart of VI

    I'm using LabView RT 8.5 together with a cFP-2110. I have shared variables hosted on the cFP, as the cFP application works by itself without the need of a host PC application. However, a host PC application can be connected and read/write shared variables to work as a GUI. The shared variables are accessed with Datasocket VIs, as the same application is to be used on different cFPs with different IP addresses.
    The Datasocket connections is opened once and then the variables are accessed in a while loop. Before accessing the variables, RT Ping Controllers.vi checks if the cFP is still accessible. If not (or if the Datasocket Read operation fails), the Datasocket connection is closed. Now here comes the problem. When I want to re-establish the connection with Datasocket Open, I only get Error 66 (Connection closed by the peer). The only way I have found to "reset" this behaviour, is to close/stop the host VI and start it again. Is there an easier way to solve this? I assume the reason lies in something not being reset in the connection between the PC and the cFP. But what, and how can it be reset? Note that I have closed the connection with Datasocket Close in case of a failure.
    I do not need answers about how I can avoid the connection failures in the first place. They can e.g. be caused by the cFP being temporarily too busy or something. The issue is when a failure HAS occurred, I want to be able to re-establish the connection without restarting the VI. How?

    Isn't there anyone with similar experiences?
    I would assume that someone would be interested in being able to restore a connection after a failure. Improving connections to minimize the risk of failures is not anyway a 100% solution. Sooner or later a failure will occur. And in that case I am not pleased with having to restart the application in order to get the system back on track.
    I have already tried searching for previous posts regarding this, but the search results are very poor. Any ideas?
    Tom C

  • Datasocket connectivity issue

    Hi all,
    I have got two applications, a Server (that is connected to Embedded Device sensoring Temperature and Humidity), and a Client that recieves this information. Now the way which I have these applications working is that BOTH have the ability to Read or Write. The Server needs to Write Temp and Humid information, and the Client needs to Read these values. But also the Client needs to Write Control information (such as Turn on fan, turn on heater, turn on humidifier etc) and the Server needs to Read these values (and process, then pass them down to the Embedded device).
    In order to do this I have set up two DataSocket connections on each application, one for Read and other for Write. They worked fine with a 'localhost' connection, but I am now testing it with two different computers over my home network.
    The problem is the Server is to be running and Connected (waiting for the Client to connect), when I connect the server the client recieves information fine, but when I try to send control information via clicking a button, the Servers error message displays (using the DS_GetLibraryErrorString I think) "Error: Not Connected: Connection timed out.".
    When I then Disconnect and Re-connect the Server everything works fine. But obviously I want to be able to prevent this situation, any ideas??
    I can post code if need be.
    Much appreciated
    Rhys

    Hi Rhys,
    That's a damn good name you've got there by the way, Rhys.
    I've tinkered about with your project and managed to get it to connect first time on my PC. I've done this by including some files from the CVI folder into your project, then re building.
    But once your code was running I wasn't able to get much functionality out of it except for the boolean buttons. Was this an issue just on my side?
    I've attached the editted project in a zip file, and also a picture showing where I found the .fp and .h datasocket files I included.
    I hope this works your side too! Have a great weekend now.
    Rhys
    Applications Engineer
    National Instruments
    Attachments:
    Prj_Greenhouse-editted.zip ‏4629 KB
    local.PNG ‏29 KB

  • OPC version of Eurotherm iTools, How the Eurotherm 2604 can be controlled with Datasocket connections

    Hi All,
    As I got some of old postings about using OPC for interfacing Eurotherm 2604 in LabVIEW. I believe there may be lot of ways to do that. If some body can help to post some examples, that would be great help.
    Thanks.

    Just make sure that the 2604 is set-up and working from the Eurotherm Modbus server.  You can then create controls and indicators in Labview and connect them to items on the 2604 using Datasocket connections.  I have an application that has been running this way for several years without any problems.  By the way, custom instruments can be created in the modbus server.  This is one way to communicate with almost any instrument to OPC.  Create a virtual instrument in the Eurotherm modbus server, create a VI that communicates with the actual instrument, then link the two using Datasocket.  You now have an instrument that can be accessed by any OPC client.

  • Open datasocket connection error 42

    Hello,
    When I run my application as a standalone appliation I get error 42 from the "Open Datasocket Connection" VI, I was able to see it using the "Enable debbuging" feature in the build specification.  When I run my application in source code I don't have any problems with the "Open Datasocket Connection".  The address provided is the exact same address for the standalone executable and the source code which points to another computer LabVIEW application.  The protocol I'm using is psp://ComputerName...
    Any ideas?
    Michel
    Solved!
    Go to Solution.

    It could be a problem that the executable cannot access the registery. That seems to be needed for Datasocket. Does it work when you start the application as administrator?
    Btw. Why do you use Datasocket to read a psp variable? You should be able to use Open Variable Connection I think? Datasocket is almost obsolete.

  • Datasocket connection check

    Hello,
    I have created a simple application that reads datasockets from datasocket server using Measurement Studio for C++. Here is the piece of my code:
    code DSRead::Connect(char* url)
    m_DataSocket.InstallEventHandler(*this, &DSRead:ataUpdatedEventHandler);
    m_DataSocket.InstallEventHandler (*this, &DSRead:tatusUpdatedEventHandler);
    CNiString targetURL = url; 
    m_DataSocket.Connect(targetURL, CNiDataSocket::ReadAutoUpdate);
    MSG msg; 
    do
    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    connectionStatus = m_DataSocket.Status;
    while ((connectionStatus != CNiDataSocket::ConnectionError)
    && (connectionStatus != CNiDataSocket::Unconnected));
    if (connectionStatus == CNiDataSocket::ConnectionError)
    return CONNECTIONERROR;
    return OK;
    In DataUpdatedEventHandler function I process received data.
    The do-while construction is used because the CNiDataSocket Connect function requires that application processes Windows messages while the DataSocket is connecting (as is explained in this post).
    This works fine while connection to the datasocket server is alive. However, when connection is lost, nothing is changed. I mean,  m_DataSocket.IsConnected() is still true and connectionStatus is still CNiDataSocket::ConnectionActive. Moreover, if connection to DataSocket server reappears, the data is still not retrieved. 
    The question is: How can loss of connection be detected in this case?
    I have a feeling, that some windows functions should be used, but I failed to find answer in internet.

    Hi Josh,
    Thank you for the reply. These two links, as far as I understand, are about Windows socket connection issue rather than DataSocket connection issue. Of course, one solution to this problem is to periodically send winsocket echo requests to DS server, but I believe it is not the optimal one.
    Probably I have explained the problem ambiguously.
    I will try to explain again, taking as an example "Simple DataSocket" project from "Visual C++ Examples" of Measurement Studio. In this example there are 3 actors: Writer, DS Server and Reader. I have a virtual machine which is connected to host in "host only" mode and has ip address 192.168.7.29. The only thing I change in the code of "Simple DataSocket" example is url: I change "dstp://localhost/wave" to "dstp://192.168.7.29?/wave" for both Reader and Writer.
    Then I launch Reader and Writer in 2 scenarios:
    1) I launch Writer, DS Server and Reader on virtual machine. Reader and Writer operate successfully: Writer writes data to DS server, Reader reads data. Both statuses are "Active:Connected".
    Then I disable network adapter of virtual machine. As is expected, we have an error both for Writer and Reader:
    2) I launch Writer and DS Server on virtual machine, and I launch Reader on the host. Reader and Writer also operate successfully: statuses are "Active:Connected". But if I disable network adapter of virtual machine, then the situation is different from first scenario:
    I.e., Writer detects network disconnection, while Reader is still "Active:Connected", while really it isn't. As I have already written, m_DataSocket.IsConnected() property is also true.
    The similar problem arises even if there is no virtual machine: when Writer and DS Server are on host A and Reader is in host B and if I unplug network cable for host A. Then again Reader cannot detect connection fail.
    Basically the question is: how automatically it is possible to detect fail of connection in such situations?
    I will explain why I ask this question. I have a simulation program that generates data and publishs it to DS Server (both are located on virtual machine). I also have Reader application located on host. I simulate network fail by disabling network adapter for virtual machine. I want Reader to automatically detect network fail and generate an error. As I have explained above, currently Reader does not detect it.

  • Buffer over run while connecting to Oracle11g from Crystal XI Release1

    hi,
    we are getting "buffer over run detected!
    program .. \Business objects\Crystal Reports 11\crw32.exe"
    A buffer over run has been detected which has corrputed the program's internal state. The program cannot safely continue execution and must be terminated."
    This is occuring when we are trying to generate stand report creation wizard using Crystal XI R1.
    can any one help me here?
    S/w: Crystal XI R1
    OS:windowsXp Sp3
    Regards,
    Ravi

    Hello,
    What happens if you create the report manually?
    And how are you connecting and who's driver. ODBC, OLE DB, or CR Oracle native drivers? If ODBC who's ODBC driver are you using?
    Oracle 11g is not in the supported platforms list so if there is an issue in our Cr Oracle driver we won't be able to fix it.
    You could upgrade to CR XI R2 for free: Start off woih the full build SP4:
    https://smpdl.sap-ag.de/~sapidp/012002523100011802732008E/crxir2_sp4_full_build.exe
    Then apply SP 5 and SP 6:
    https://smpdl.sap-ag.de/~sapidp/012002523100013876392008E/crxir2win_sp5.exe
    https://smpdl.sap-ag.de/~sapidp/012002523100015859952009E/crxir2win_sp6.exe
    Do not uninstall XI R1 before installing R2, use your XI R1 keycode.
    Then you should have 11g support...

  • I would like someone to tell me how to use the dstp address parameter(url) in the datasocket connections.What to write in there, destination/source url.

    What do i do if i right to a datasocket..Do i have to make a special file on my server, How do i create a datasocket server.?? Do i use the same "address" to read a datasocket?

    The URL is the address of the DataSocket server. The server program is a stand-alone program that handles connections and broadcasts data. You create a server by running the program that comes with LabVIEW. You publish to (write) and subscribe from (read) the server and both would use the same address. Normally the data is not file based but DataSocket does support file reads by specifying file or ftp instead of dstp in the URL. The server can be running on the same computer as a publisher/subscriber or on a different computer. NI is now offering a class called LabVIEW Networked Measurements that covers DataSocket. I strongly recomend it.

  • Where is front panel datasocket connection

    After successfully using front panel data socket connections in the past I have now discovered that the menu item is gone.  Anybody have any idea as to why? 
    LabVIEW 8.0.1
    WinXP/SP2
    Why can't I paste a screen shot?
    LabVIEW 8.0.1; WinDoze XP
    aut viam inveniam aut faciam

    The only data socket control that I see is the Datasocket Refnum (reference control), which is located in the refnum palette.
    I think all other functions are found in the block diagram palette.
    RayR
    Message Edited by JoeLabView on 12-17-2007 08:04 AM
    Attachments:
    datasocket.PNG ‏6 KB

  • Datasocket connection to remote target

    I want to connect two VI with the Datasocket Server using the functions Datasocket read and write.
    The datasocketserver receive the data from the VI on the remote target (the PXIcontroller), but the VI on the host recognize no connection (unrecognized protocol).
    The URL which I gave them was dstp://x.x.x.x/data .
    x.x.x.x stands for each IP of the other system which I want to connect to.
    I use XP with Labview 7.1 on the host-PC and  RT Labview as an OS on the PXI controller (PXI-8186).
    Regards, Jbrib

    Hello There:
    This is a duplicate discussion forum. I have posted an answer at the following link: http://forums.ni.com/ni/board/message?board.id=270&message.id=2039
    Thanks,
    Jaideep

  • DataSocket connection too slow

    Hi everyone
    Am using DataSocket server to communicate between various application over the network, some of the application are programmed using Labwindows CVI and some of the data acquisition application are programmed using Labview.
    When the CVI application is started the DataSocket server is connected almost instantaneously, but the labview applications connect very slow almost takes a minute, and the DataSocket server hangs till all the connection are not established. the labview applications are running in embedded controllers NI PXI 8186. Am using 8 dataitems in each labview application and there are 4 such applications.
    so when all of the application are started at a time the problem is more severe, can any one tell me how is that i can improve the connection speed?
    Thanx for the reply.
    regards
    Arun

    hi there
    be sure to use the Open/Close Connection functions. see attachment.
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"
    Attachments:
    DSTP_IO_7.1.vi ‏24 KB

  • I want to publish my data using datasocket connection on the net and I want to use Front panel binding. Can I?

    I want to publish my data on the net.
    I want to use front panel binding and I do not want
    to write the code. Can I do that. What should I modify
    in my datasocket server manager. The other question is, When I open my VI, I want to open automatically my DataSocket Server. My english is bad. When I open the LabView I also want to open my DataSocket server. How can I do this?

    To use datasockets to publish data to be accessed via the web, see the following document.
    http://digital.ni.com/public.nsf/websearch/F58A6C2DAAADECB68625672400636145?OpenDocument
    This document explains how you can create an interactive Web page with which users can view data from a remote acquisition application without the common problems of a client-server application. You use the Measurement Studio DataSocket control and Microsoft Visual Basic to create a software component that you can insert in a Web page. You then use that Web page to read, write, or share data with other applications across the Internet.
    If you want to publish data but do not want to write any code, you should consider the web publishing tool available in Labview 6.1. This tool allows
    you to create a webpage to be published from the the LabVIEW webserver on your machine. See the following link for more information on ways to easily publish to the web from LabVIEW.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/E4E311FA046EE24586256B1F0074F39D?opendocument
    As for starting the datasocket server when you run your VI, you can use the 'System Exec' VI to run the application. The exe to start the server is located in the following directory:
    C:\Program Files\National Instruments\DataSocket\cwdss.exe
    I hope this is helpful.

  • Data Buffer using xMII connected to ECC through XI

    Hi all,
    Is there anyway to use xMII data buffer using XI to connect to ECC?
    Thanks

    Hi,
    The failed messages are stored temporarily in the NetWeaver database and used by the JMS queue which retries sending the message until that is delivered by executing the RFC. So even if the MII server is restarted the messages to be retried are present in the database with pending status which will be retried by the JMS queue.
    Thanks,
    Dipankar

  • Datasocket VI at client side just stops

    Hi guys, I am trying to send microphone-captured sound to another PC (both PCs connected by cross-over cable). I tried various options like TCP, Datasocket but none worked. With TCP it always shows input buffer overflow. With Datasocket, it doesn't show any error but the VI on the remote PC just stops. I have not been able to figure out the problem. I am using LabVIEW 2009 version 9. I am attaching the two VIs for your testing. Please help. Thanks. Regards.
    Solved!
    Go to Solution.
    Attachments:
    sound_input.vi ‏16 KB
    sound_output.vi ‏21 KB

    Hi Rocky,
    I looked at your code, and made a few changes. First, I couldn't tell why you were dividing the samples/ch by two for the read sound function. I disabled that. Also, the "Initial Data" you were feeding to the first "sound write" VI and at the default data input of the DataSocket Read function was a waveform cluster. The sound data sent over the DataSocket connection is an array of waveform clusters (one cluster per channel). This probably was causing DataSocket problems for ya.
    I set the sound configuration values to what I found in the "Continuous Sound Input.vi" example VI. I also added a few charts for visual indications.
    Note that you must have DataSocket Server running (on windows: Start->Programs->National Instruments->DataSocket->DataSocket Server).
    If these don't work, I'd look at network/firewall issues. Also, if you want less latency, consider using straight-up UDP. It should have less overhead than DataSocket (and with a crossover connection, I'd guess you won't have much data loss to worry about).
    Message Edited by RandyP on 03-03-2010 10:29 AM
    -Randy
    -=--=-=-=-=-=-=-
    Nothing like a good dose of LabVIEW to cure what ails ya'.
    Attachments:
    sound_input.vi ‏21 KB
    sound_output.vi ‏22 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

  • Mail server died - please help!

    Hi! I changed some setting in /etc/amavisd.conf today to this: $satag_leveldeflt = 2.0; # add spam info headers to all messages $satag2_leveldeflt = 4.0; # add 'spam detected' headers at that level $sakill_leveldeflt = 8.0; # send to quarantine $sads

  • Upgrading to Leopard From Tiger for MacBook Pro

    I am currently using a MacBook Pro with the following specs: Model Name: MacBook Pro 15" Model Identifier: MacBookPro1,1 Processor Name: Intel Core Duo Processor Speed: 1.83 GHz Number Of Processors: 1 Total Number Of Cores: 2 L2 Cache (per processor

  • Is snow leopard compatible with remote desk top verion 3??

    I want to connect a minimac to an FW800 running 10.5.6. Bob

  • How do I fix the herky jerky video?

    I am running a Dell Optiplex 320 with pentium D. 3.0 GHz, 2MB ram, with NVIDIA 512 MB video card. How do I fix the herky jerky video?

  • SCCR Keys. Register object: Authorization Error!

    In section "service.sap.com/sscr" i can not receive a key of access to object. Error message: "Autorization error! Currently you do not have authorization to use this function. To request the authorization, please contact one of the administrators at