Thang Nguyen Posted April 2, 2009 Report Share Posted April 2, 2009 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 Quote Link to comment
Thang Nguyen Posted April 2, 2009 Author Report Share Posted April 2, 2009 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. Quote Link to comment
Mark Yedinak Posted April 2, 2009 Report Share Posted April 2, 2009 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? Quote Link to comment
Thang Nguyen Posted April 3, 2009 Author Report Share Posted April 3, 2009 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. Quote Link to comment
JustinThomas Posted April 4, 2009 Report Share Posted April 4, 2009 QUOTE (Thang Nguyen @ Apr 3 2009, 12:11 AM) Thank Mark,I change to use share variable already. This is more efficient in my case. I was just about to recommend shared variables. Thats an easy way out. Justin Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.