How to manage the threads for TCP communication?

Hello

I have a project to control two separate applications (C++ and LabView) and two of them are implemented as server. Another client program (C++) is used to control applications. Communication between them are implemented using TCP socket. The client program sends the message to start or stop tasks on servers. The client program also sends time (HH) with the message start and end to determine when to start or stop.

Application in C++ (server): Listening to the request for the connection and when gets one, it creates a thread of communication allowing to manage this and listen again to another connection. Communication wire crossing of handles and messages when it receives a start or a stop message, it creates a thread of timer with the received time to trigger a task at the time specified. And after that he expects the client message. So, here, when the thread (communication, timer) is necessary, it is created.

In LabView (server): I tried to create the same as the C++ server. But, in manual of LabView and other discussions of the forum, I got that LabView is multithreaded and it can be done with the help of the loop independent. So, I had to create four loops in a diagram:

1. wait the new connection

2 manage the communication for the already received connection

3. start the timer

4 stop the timer

and they are executed at the beginning of execution and communication between them are managed using local variables. But, 2, 3 and 4th loop can handle only one connection and it can handle another if the current is closed. The C++ application can handle multiple connections by creating the thread when it is necessary, but not at the beginning of the application.

Is there a better way to implement this in LabView?

Is it possible to manage multiple connections and create the diagram node/block (such as a wire) dynamically as C++?

Thank you.

There are several ways to do so in modern LabVIEW and you should probably seek the Finder example for TCP examples. The classic is to transfer the refnum of connecting the listening loop in a communications loop that adds to an array of login credentials and then constantly iterates through this array to make the communication. He works on LabVIEW 4.0 perfectly for me even for applications with basic HTTP communication protocol. But you must make sure that the communication for a connection is not delaying his work for reasons that would delay the handling of other connections too, because they are really of course worked on sequentially. If you encounter an error, the connection ID is closed and removed from the table.

The other is that create you a VI that makes your entire communication and ends on an error or when the order quite. Make this reentrant VI and then launch it through VI server as the instance home, passing the refnum of newly received connection form the listening loop. Then use the method to Run let start and operate as an independent thread.

For all these, you should be able to find an example in the example Finder when searching for TCP.

Tags: NI Software

Similar Questions

  • How to manage the photos Lightroom when using 2 computers, keeping any changes made on one or the other?

    Based on http://forums.Adobe.com/thread/1308132?TSTART=0 I decided to add each question separately:

    Hello, I am very interested in buying Lightroom 5.2. I tried the RC that was missing today. Yet, I have several questions that I can't find really good conclusive answers, I'd like to get an answer before buying LR. Please do not write maybe like this or that (assumptions), because I don't want to start my entire workflow and then realize that I have to change all around, please reply, if you know for sure that something works and you are, preferably, using this method too.

    Is the big question, where I want to especially a conclusive answer:  How to manage the photos Lightroom when using 2 computers, keeping all the changes made on one of them, using the same photos for editing. I'm not going to use DNG. Details: I mainly use my old MacBook Pro, but I wish I could use my PC as it is much better (card: i5 2500K, 16 GB of RAM, SSD, USB3, nVidia GTX 560 TI etc.). I have 2 external HD that I could use, one for backup and one for the actual Photos/changes. I you will probably need to use as my internal HDs are fairly complete and I cannot be the kind of things simply delete or move to one (developer, without loss of music, programs etc.).

    On this basis, how do I save all such Photos folder (pictures and retouching and preferably presets too)?

    According to me, that it should be possible to work cross-platform without having to create a link to the files each time, or without having to keep export/import of the catalog, keeping the single catalog and the picture library on an external drive that is then switched between systems as needed.

    Obvious first requirement is an external drive that is formatted in a way (for example, FAT32) that it can be used on both platforms in read/write mode. Given that, if the catalogue AND folder parent si le catalogue ET le dossier parent images are both set to the same level in a global parent folder, then it should be possible to take advatage of ability of Lightroom to use relative paths instead of absolute paths to detect the images, no matter if the player is named (Mac) or lettering (PC). This is how "export as catalog of ' works, that is, it creates a 'package', alias a parent folder, containing the catalog and a replica of the folder hierarchy to exported along with the catalog images. Take this 'package' to another system (same OS or not) and "it works" even if the drive letter is different or the operating system is different... because the relative path of the image catalogue is always the same.

    I have not tested this cross-platform (if I have between various PC systems with letters of different readers) so for me it's still just a theory, but there may be others who have done this successfully.

  • How to install the patch for the security hole last QT process running on a Dell with Windows 7 (Windows 10 upgrade) laptop? I got a message from my program called Belarc that the patch is missing on this device. Thank you

    How to install the patch for QuickTime Pro for Windows 7 on a Dell laptop... I got an alert through a program which I run from time to time (Belarc) and it says that there was a security breach detected by Apple (or one of its vendors, who manages the security of the operating system such as Cisco) during December 2015.

    Please notify.  Thanks in advance for your guidance pertaining to my question.

    Download QuickTime for Windows - Apple 7.7.9

    Apple ends development of QuickTime Player 7 for Mac and Windows operating system, so don't expect much more beyond this last version.

    The installation shows are supported for Windows 7 and lower, so I don't know what to expect on Windows 10.

  • How to manage the tv after hdmi to hdmi connection

    I want to connect to my computer windows 7 with tv on my Vizio tv hd tuner. I intend to use the hdmi to hdmi connections. After that I made the connection how to manage the tv without going back to the computer. My TV is in another adjacent room to my computer, sbout 20 ft away. Can I use a wireless mouse to manage the tv? The monitor and tv both appear at the same time? What are other options? Thank you for taking my question and to meet others, I put in the forum. Donnie

    I guess that the xbox 360 is a must for my setup. Thanks for your reply, Donnie

  • I forgot my password for my admin user account, but I have a secondary account how to get the password for the admin

    original title: admin password.

    I forgot my password for my admin user account, but I have a secondary account how to get the password for the admin

    Hello
    Microsoft technical support engineers cannot help you recover the passwords of the files and Microsoft who are lost or forgotten product features. For more information about this policy, please refer to the sticky below.

    http://social.answers.Microsoft.com/forums/en-us/vistasecurity/thread/3eba3150-8742-4264-be9f-0daaad2282cd Lisa
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • HOW TO CHANGE THE WALLPAPER FOR ADOBE AIR AS3 IN BB10?

    HOW TO CHANGE THE WALLPAPER FOR ADOBE AIR AS3 IN BB10?

    Please only start a thread.

    Original thread:

    http://supportforums.BlackBerry.com/T5/Adobe-AIR-development/changing-background-wallpaper-BBZ10/TD-...

  • How to reset the permission for application settings after installation?

    Hello

    One of my clients just sent me and she accidentally disabled (this refusal) "Geolocation" permission when you run the application for the first time.  She tried to uninstall and reinstall the app, but she says that the permissions screen is then short-circuited.  Does anyone know how to reset the settings for authorization for an application on the Playbook?

    see you soon

    Mark

    Unfortunately I still haven't a tablet to test this on, but looking at the screenshots of settings menu on the berryreview.com website, it seems that permissions can be managed in the Security tab.

  • How to manage the SOAP response

    Hello (beginner vCO),

    I use the SOAP Plugin and trying to figure out how to manage the here, a host of SOAP response is the log I get the SOAP response

    [12:53:43.124 2014-05-09] [I] the settings...

    [12:53:43.135 2014-05-09] [I] the available settings:

    [12:53:43.136 2014-05-09] [I] + parameter name: "GetRequestStatusResult", value: "< response >

    < item >

    < ServiceRequestID > SR138917 < / ServiceRequestID >

    OS DEPLOYMENT < ServiceRequestStatus > < / ServiceRequestStatus >

    < ServiceRequestCreated > 09/05/2014-15:20:25 < / ServiceRequestCreated >

    < ServiceRequestCompleted > < / ServiceRequestCompleted >

    MA138921 < CurrentActivity > < / CurrentActivity >

    OS DEPLOYMENT < CurrentActivityTitle > < / CurrentActivityTitle >

    < ActivityStartUTC > 09/05/2014-15:32 < / ActivityStartUTC >

    < ActivityEndUTC > < / ActivityEndUTC >

    < DurationTotalSeconds > < / DurationTotalSeconds >

    < AverageDurationSeconds > < / AverageDurationSeconds >

    < SecondsOffAverage > < / SecondsOffAverage >

    < EstimatedCompletionUTC > < / EstimatedCompletionUTC >

    < / OutputParameters >

    < warning > < / warnings >

    < exceptions > < / Exceptions >

    < / response > '

    It will be better to try and parse text or try and use another method with vCO

    If you haven't done so already, take a look at the action of com.vmware.libarary.soap.processOutParameters.  It is the action that generated the log you have placed in us.  It generates an object Properties (key, value pairs) with the value for each setting that results.

    In your case, assuming that 'outProps' is the result of the above, you can use:

    var getRequestStatusResult = outProps.get ("GetRequestStatusResult");

    And to analyze the code XML with E4X as Ilian said.

  • How to disable the option for children to receive messages from my iPhone on their iPhones?

    How to disable the option for my children to receive my iPhone imesages on their iPhones?

    Do not share account iCloud with them. iCloud accounts are not meant to be shared.

  • How to get the manual for Satellite Pro 4200?

    How to get the manual for Pro 4200. I have download olm_up and setup.exe (72 kt) of http://eu.computers-toshiba-europe.com?.

    Hello

    Please visit this link:
    http://EU.computers.Toshiba-Europe.com/cgi-bin/ToshibaCSG/download_manuals.jsp

    I m you will find a good manual of your device.

    Good bye

  • Office jet Pro 8600: how to change the folder for the scans on my Apple?

    Hi, I want to know how to change the destination for my scans folder when I scan from the printer.  Currently, the scans go to "documents", and I want him to be in a business case.  Clues?  I tried to watch some instructions on the previous posts, but it seems that they are for windows.

    Thanks for the help!

    Hi @jgossc,

    I'd be happy to help you change your scan destination. I understand that when you scan your Officejet Pro 8600 to your Mac, the file analysis is currently underway to your documents and want to let them instead to a business case.

    To change the destination please follow the steps below and let me know the results of your efforts:

    • Open HP utility
    • Select Scan to the computer
    • Click Scan tasks to change
    • Choose a shortcut to scan
    • Select Edition
    • In the options listed here, you should see scan destination

    If this resolves the issue, please click Accept as Solution button below; If not, let me know and I will do everything I can to help. Thank you.

  • How to connect the keyboard for apple tv wireless?

    How to connect the keyboard for apple tv wireless?

    If you mean the 4th generation new Apple Tv, you cannot currently. It does not support keyboards at this time.

    If you mean the 3rd generation Apple Tv:

    Use a keyboard Apple Wireless with your Apple TV (2nd or 3rd generation) - Apple supported

  • I know how to force the Spotlight for re - index a drive or a folder. But how then do I mail?

    I know how to force the Spotlight for re - index a drive or a folder.

    But how then do I mail? I drag this file to the window?

    Thank you.

    Try re-indexing of mailboxes mailbox. This can take some time if you have a lot of mail.

    Reindex messages           For El Capitan, try looking in V3.

    Reindex messages (2)        See post by Linc Davis

  • How to recover the password for AirPort Extreme in ipad

    How to recover the password for the ex airport in ipad

    Use your Keychain Access iCloud, if you create a.

    Frequently asked questions about iCloud Keychain - Apple Support

    Soft reset the airport and you can connect for 5 min and recover the passwords.

    Reset to a base station AirPort FAQ - Apple Support

  • I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?

    I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?

    Set a password to disk... disk tab in the utility... and just give to those you want to use the TC...

Maybe you are looking for