How applet can read continuous data stream

How applet can read continuous data from server(like database update)

You can keep opened a socket to the server. You can send any data from/to the applet in that way.

Similar Messages

  • Create a continuous data stream from C++, and read it in LabView

    Hello all.
    I'm working on a project which involves connecting to a motion tracker and reading position and orientation data from it in realtime. The code to get the data is in c++, so I decided that the best way to do this would be to create a c++ DLL file which contains all the necessary functions to first connect to the device and read the data from it, and use the Call Library Function node to feed this data into Labview. 
    I'm having trouble though, since ideally I would like a continuous stream of data from the c++ code into Labview, and I'm not sure how to achieve this. Putting the call library function node in a while loop seems like an obvious solution, but if I do it this way I would have to reconnect to the device every time I get the data, which is quite a bit too slow. 
    So my question is, if I created c++ function which created a data stream, could I read this into Labview without having to continually call a function? I'd prefer to only have to call a function once, and then read the data stream until a stop command is given.
    I'm using Labview 2010, version 10.0.
    Apologies if the question is poorly phrased, many thanks for your help.
    Dave
    Solved!
    Go to Solution.

    dr8086 wrote:
    This method sounds like an excellent suggestion, but I do have a few questions where I dont think I've understood fully.
    From what I understand the basic premise is to use one call library function node to access a DLL which creates an instance of the device object, and passes a pointer too it into labview. Then a seperate call library function node would pass this pointer to another DLL which could access the device object, update it and read the data. This part could be in a while loop and carry on reading the data until a stop command is given.
    That's it. I'm including some skeleton code as an example. I'm also including the code because I don't know how much you have experience with multi threading, so I'm showing how you'd have to use critical sections to guard the interactions between threads so that they don't lead to issues.
    // exported function to access the devices
    extern "C" __declspec(dllexport) int __stdcall init(uintptr_t *ptrOut)
    *ptrOut= (uintptr_t)new CDevice();
    return 0;
    extern "C" __declspec(dllexport) int __stdcall get_data(uintptr_t ptr, double vals[], int size)
    return ((CDevice*)ptr)->get_data(vals, size);
    extern "C" __declspec(dllexport) int __stdcall close(uintptr_t ptr, double last_vals[], int size)
    int r= ((CDevice*)ptr)->close();
    ((CDevice*)ptr)->get_data(last_vals, size);
    delete (CDevice*)ptr;
    return r;
    // h file
    // Represents a device
    class CDevice
    public:
    virtual ~CDevice();
    int init();
    int get_data(double vals[], int size);
    int close();
    // only called by new thread
    int ThreadProc();
    private:
    CRITICAL_SECTION rBufferSafe; // Needed for thread saftey
    vhtTrackerEmulator *tracker;
    HANDLE hThread;
    double buffer[500];
    int buffer_used;
    bool done; // this HAS to be protected by critical section since 2 threads access it. Use a get/set method with critical sections inside
    //cpp file
    DWORD WINAPI DeviceProc(LPVOID lpParam)
    ((CDevice*)lpParam)->ThreadProc(); // Call the function to do the work
    return 0;
    CDevice::~CDevice()
    DeleteCriticalSection(&rBufferSafe);
    int CDevice::init()
    tracker = new vhtTrackerEmulator();
    InitializeCriticalSection(&rBufferSafe);
    buffer_used= 0;
    done= false;
    hThread = CreateThread(NULL, 0, DeviceProc, this, 0, NULL); // this thread will now be saving data to an internal buffer
    return 0;
    int CDevice::get_data(double vals[], int size)
    EnterCriticalSection(&rBufferSafe);
    if (vals) // provides a way to get the current used buffer size
    memcpy(vals, buffer, min(size, buffer_used));
    int len= min(size, buffer_used);
    buffer_used= 0; // Whatever wasn't read is erased
    } else // just return the buffer size
    int len= buffer_used;
    LeaveCriticalSection(&rBufferSafe);
    return len;
    int CDevice::close()
    done= true;
    WaitForSingleObject(hThread, INFINITE); // handle timeouts etc.
    delete tracker;
    tracker= NULL;
    return 0;
    int CDevice::ThreadProc()
    while (!bdone)
    tracker->update();
    EnterCriticalSection(&rBufferSafe);
    if (buffer_used<500)
    buffer[buffer_used++]= tracker->getRawData(0);
    LeaveCriticalSection(&rBufferSafe);
    Sleep(100);
    return 0;
    dr8086 wrote:
    My main concern is that the object may go out of memory or be deallocated, since it wouldnt be held in any namespace or anything.
    Since you create the object with new, the object won't expire until either the dll is unloaded or the process (LabVIEW) closes. So the object will stay valid between dll calls provided LabVIEW didn't unload the dll (which it does if the VIs are closed). When that happens, I'm not exactly sure what happens to live objects (i.e. if you forgot to call close), I imagine the system reclaims the memory but the device might still be open.
    What I do to make sure that everything gets closed when the dll unloads before I could call close and delete the object is to everytime I create a new object in the dll I add it to a list, when the dll unloads, if the object is still on the list I delete it.
    dr8086 wrote:
    I also have a more general programming question about the purpose of the buffer. Would the buffer basically be a big table of position values, which are stored until they can be read into the rest of the VI? 
    Yes, see the example code.
    However, depending on the frequency with which you need to collect data from the device you might not need this buffer at all. I.e. if you collect a sample about every 100ms then you could remove all threading and buffer related functions and instead read the data from the read function itself like this:
    double CDevice::get_data()
    tracker->update();
    return tracker->getRawData(0);
     Because you'd only need a buffer and a seperate thread if you collect data at a high frequency and you cannot lose any data.
    Matt

  • How Server can read client side SSL certificates through java code?

    My code will be running on server which will be a java class that should read any SSL certificates for the user that is logging in to the application.
    Kindly let me know how it can be achieved ? I have very rare knowldge on Security. how i can read SSL certificates of the client machine.
    Also let me know the possible solutions for above question.

    For my mud written in java, I used TCP/IP for the connections. When a client connects, he gets his own thread. Those threads are held in a vector in a manager class. each tick of the server does a quick run thru the vector and if the current thread/socket its on is null or !isAlive() its remove from the vector(which in turn removes it from getting any more game updates. This removal can be caused by two things. The clients disconnects by accident(kills his game, locks up has an internet connection hiccup, etc.) or he uses the games "quit" method. The quit method calls a method that does any player saving of data, etc then closes the socket, and sets it to null. thus the manager sees this and removes him frm the vecotr list on the next server tick. Seems to work great form a mud and worked really well in a multiplayer applet game I had up for a while.

  • WCF Service and Sharepoint Form library : How i can read a access a form libray and query a item from file name and read form xml in WCF service ?

    WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
    Ahsan Ranjha

    Hi,
    In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
    SharePoint 2013 REST API
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
    http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
    SharePoint 2013 Client Object Model
    http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
    With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
    http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
    http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
    Best regards
    Patrick Liang
    TechNet Community Support

  • How we can automate the data loading from BI-BPC

    Dear  Guru's
    Thanks for watching this thread,my question is
                  How we can load the data from BI7.0 to BPC.My environment is SAP-BI 7.0 and BPC is 7.5 MS version and 2008SQL.
    How we can automate the data loading from  BI- BPC Ms version.Is manual flat file load is mandatory in ms version.
    Thanks in Advance,
    Srinivasan.

    Here are some options
    1) Use standars packages and schedule them :
        A) Openhub masterdata file into a flat file/ BPC App server  and Schedule the package - Import Master Data from a Data File and  other relevent packages.
    2 ) Using Custom Tasks in Custom Packages ( SSIS)
    Procedure
    From the Microsoft SQL Server Business Intelligence Developer Studio, open the Microsoft SSIS folder.
    Create a new package, or select an existing package to modify.
    Choose  Task  Register Custom Task .
    In the Task Location field, browse for the target .dll file.
    Note
    By default, the .dll files are stored in BPC/Websrvr/bin.
    End of the note.
    Enter a task description, select an appropriate icon, then click OK.
    Drag the icon to the designer window. Enter data as required.
    Save the package.

  • Rescheduling of Maint order..(how we can postpone the date of maint order)

    Hi friends,
    I would like to know that how we can postpone the date of maint order.I am working on preventive maintenance plan.Let consider my maint plan is based on key date so that system is generated orders like for 90 dyas cycle time as below.
    10 jan
    10 feb
    10 mrach
    But suppose there is certain req.from sales dept. so production dept want to use the machine. So machine is not available on that day (10 jan) but it will be free after 2 days for maintenance .Then I want to know
    1.how i can shift the order date from 10 to 12 jan.
    2.What about the planning cycle? It remains constant as per system date or it will change proposed date automatically.
    Awaiting for reply..
    Thanks and regards,
    Pravin

    Hi,
    If automatic scheduling is active,
    In case of backward scheduling (default for preventive maintenance) change the the basic end date
    In case of forward scheduling change basic start date.when the order is saved order will be rescheduled automatically.
    You can avoid the shift of next mainteannce call by giving proper scheduling parameters in Maintenance plan.

  • How I can change Hollydays date in my calendar . In UAE -Fri-Sat it's Hollydays

    How I can change Hollydays date in my calendar . In UAE -Fri-Sat it's Hollydays

    Numbers & most apps, especially those from Apple, use the date format you have set in System Preferences > Language & Text > Region. You can then choose UK from the Region drop-down list. Mine says Custom because I've defined things further as in the second screenshot.

  • What VI can read raw data from a TDMS file with scaling information entered?

    I would like to use scaling with my TDMS files so that the end user will
    only see engineering unit values, however, within my Labview application, I
    want to retrieve the raw data.  Is there a way to read the raw data using
    one of the Vi's in Labview?

    The scaling information in a TDMS file is stored as properties of the channel.  One trick (that I haven't mastered yet) is you can change the properties of the TDMS file (set properties) and set all the scales to have a offset of 0 and a scale of 1.  This will apply a scale that has the engineering units be the same as the raw values.  Then you can read the data like normal and you'll get the raw values.
    There are several issues to be aware of, the first is changing the scale and forgetting to change it back, or some how modifying the data to be incorrect units and not knowing it.  For this reason I'd recommend making a copy of the TDMS file to a temporary location to make the modifications to the properties, read it, then delete the temporary TDMS file when you are done.  
    This is the only way I know of to get the raw readings from a scaled TDMS channel.  
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • HT4859 does anyone have any idea how one can keep their data on iPad after leaving icloud as it appears that you loose all data when doing this...its killing me!!!

    does anyone have any idea how one can keep their data on iPad after leaving icloud as it appears that you loose all data when doing this...its killing me!!!

    rtilghman wrote:
    telling me to buy a new router is NOT a solution.
    And why not? Apple is selling these things like BigMacs. They can't make enough of them. You've been suffering since May because you refuse to get a decent router.
    Can you imagine if a company that makes a refrigerator told me that I needed to upgrade my electrical system to rectify a problem with their device? What kind of response IS that?!?!
    What if the problem with their device is that it requires a new-fangled "grounded" outlet and your circa 1890 house doesn't have grounded outlets. Would you refuse to purchase a $ 25 adapter on principle?

  • My IPhone need to restore, but I want to backup my data first. Itunes keep telling me you must restore this iphone before it can be used. How I can backup my data?

    My IPhone need to restore, but I want to backup my data first.
    Itunes keep telling me you must restore this iphone before it can be used. How I can backup my data?

    At this point it is too late. When you restore it will restore the backup made at the time of the last sync. And changes to the phone's content after that last sync will be lost.

  • Can you tell me how I can put the data of sql server into SAP to auto gener

    Dear all,
             Can you tell me how I can put the data of sql server into SAP to auto generate PR?
    Best regards,
    Merry zhang

    Many thanks ,it is ok now.

  • How I can see the data of my message after processing?

    Hi guys,
    My scenario is XI -> R/3 (asynchronous) using ABAP Proxy.
    When a try to send a message the flag code is ok and the message enters in R/3 inbound queue, so it means that everything ok!
    I want to know how I can see my data in queue or better how it enters in proxy and how I can see? In proxy method I put a break point... but can't stop there!!!
    What I need to do to make a little test and verify that really works?
    Anybody could help?
    Thanks in advance,
    Ricardo.

    Hi Ricardo
    If you want to do Debug Asyn Inbound proxy. Do the following steps.
    1. Get the Queue-Id from MONI.
    2. Deregister the Queue for your message (SMQR).
    3. Now resend the message. The message will be stopped in the Deregistered Queue.
    4. Start Transaction SMQ2 and select your specific Queue. Double clicking will take you to the detailed level.
    5. Press F8 to start the Debugger. And now you can debug the whole Proxy mehtod for Inboud proxy method.
    Check the file 'How to Debug XI Applications' for more information.
    https://websmp204.sap-ag.de/~form/sapnet?_SHORTKEY=01200252310000071155&_SCENARIO=01100035870000000202
    Regards
    Paresh

  • I have an unlocked iphone 4s bought from apple. Will be in London and Paris and would like to know if how I can purchase a data plan while on vacaqtion

    I have an unlocked iphone 4s bought from apple. Will be in London and Paris and would like to know if how I can purchase a data plan while on vacaqtion

    Can I still use the phone in Boston when I move there?
    Only on a supported GSM carrier.
    Will there be networks I cant use?
    Yes. CDMA networks.
    As I understand it the 4S supports GSM and CDMA networks worldwide.
    No, you've misunderstood. The GSM iPhone you can buy in Ireland supports GSM networks only i.e. AT&T

  • How i can Catch perticular data from internet and update SAP R/3 data?

    Hi All,
    I want to catch data from internet and want to update those data into SAP R/3 database. So how i can catch those data ?. what will be format of data to update SAP R/3 database?

    Hi,
    You need to create your own BSP pages which would be displayed on internet/HTML.
    Transaction SE80 => Select BSP application.
    Best regards,
    Prashant

  • HT201270 i have just updated my old 3GS and now when i am on restore the window is comming up and asking for a password. i have not set up a password for restore, please help how i can restore my date???

    i have just updated my old 3GS and now when i am on restore the window is comming up and asking for a password. i have not set up a password for restore, please help how i can restore my date???

    capriz wrote:
    i have just updated my old 3GS ...
    To what... iOS 7 is Not supported on the 3 GS

Maybe you are looking for

  • How to use Facebook in appile tv

    How to use iphon 4s(Facebook) in appile tc

  • Partion By,Cumulative% problem in Discoverer: Pla help

    I have a query like this for supplier spend report.. SELECT ORG_ID, COMPANY, SEGMENT1, OU, INV_ORG, --INV_ORG_ID, VENDOR_NAME, INVOICE_ID, PRODUCT_TYPE, PERIOD_NAME, AMOUNT_PAID, SUM(AMOUNT_PAID) OVER(PARTITION BY ORG_ID,PERIOD_NAME ORDER BY AMOUNT_P

  • Error while calling hr_psbuffer_initialize

    Hi, I have a scenario where, I need to call FM RH_PM_GET_TIMECONSTRAINT, followed by some code which calls to FM HR_PSBUFFER_INITIALIZE. For Some Infotypes like PA0014 where TimeConstraint need to be read from T582A, the FM RH_PM_GET_TIMECONSTRAINT s

  • Full screen caller id on ios 8.1.1

    Hi there can anybody tell me if full screen caller id is possible on ios 8.1.1 and how can i do it? thanks

  • Check for two conditions

    Major brain-fart here.... been doing a bunch of .net stuff lately and am forgetting syntax... If I want to check 2 conditions, how do I string them together? This obviously doesn't work... if (my_label1.text == ('Aetna Open Access 1.0')) & (my_label2