Jump to content

Need help to communicate 2 programs


Recommended Posts

Hi,

I need a solution to communicate between 2 lapview programs which need to provide a stable and robust connection status because the time is cirticle in my project. These two programs send and receive command and data to each other.

I already tried with TCP/IP VIs but it didn't work well. The reason maybe be the result of currently one of my program using the TPC/IP to communicate with a CAN device though a TCP/IP virtual server. And this communication is interfered so either I lost signal on the CAN or my TCP listener got timeout.

I wonder should I use datasocket in this case or not? In this case I have questions:

1. Cause two program are write and read, so should I make them both publisher and receiver? Can I do that?

2. To send out multiple variable should I use different URL for different variable?

3. In this presentation example: http://zone.ni.com/devzone/cda/tut/p/id/5168

They just use directly the DS Read and Write with the URL while in the example of LabVIEW DS Writer and Reader, they use the Launch DS server if local URL. Should I use this VI? And in case I need to read or write multiple variables, should I use each of this VI for each variable?

Thank you for your time.

Best regards,

Thang Nguyen

Link to comment

Hi,

I am trying to make the TCP work follow the Simple Data Server and Simple Data Clien in the NI Example. I am not sure but the communication is not correct rignt. I attach the screenshot here.

The client receive is inside a time loop at dt=100ms. The Server send is inside a loop at dt = 100ms.

Link to comment

Are the server and client running on the same machine? Do you have access to a network sniffer like Wireshark to look at the network traffic? Also, 100 ms can be a bit short in terms of network timeouts depending on your network topology. In addition, your wait on listener will only wait for 100 ms and then stop listening. You should have your server (the listener) be always waiting for connections and service connection as they come in. How large is the data that you will be sending? If you are sending large amounts of data you will not be able to send it all in a single packet and depending on what else is happening on the PC it could delay the transmission of the entire data set with the 100 ms window that you have established. Though you are timing out on the intial two bytes of data. Would it be possible for you to post your code?

Link to comment

QUOTE (Mark Yedinak @ Apr 1 2009, 04:17 PM)

Are the server and client running on the same machine? Do you have access to a network sniffer like Wireshark to look at the network traffic? Also, 100 ms can be a bit short in terms of network timeouts depending on your network topology. In addition, your wait on listener will only wait for 100 ms and then stop listening. You should have your server (the listener) be always waiting for connections and service connection as they come in. How large is the data that you will be sending? If you are sending large amounts of data you will not be able to send it all in a single packet and depending on what else is happening on the PC it could delay the transmission of the entire data set with the 100 ms window that you have established. Though you are timing out on the intial two bytes of data. Would it be possible for you to post your code?

Thank Mark,

I change to use share variable already. This is more efficient in my case.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.