Draqo85 Posted July 19, 2008 Report Share Posted July 19, 2008 HI, I want to make two programs, first will be sending data from daq (4 channels, 1000 probes) , second will be receiving data from this first program. I have one problem because this second program receive not the same numbers of data and those charts are diffrent. First two pictures is sending program , 3,4 picture is receiving program. Please help me, how to do this second program to read the same number of data which is sending this first program. Thanks Quote Link to comment
Neville D Posted July 19, 2008 Report Share Posted July 19, 2008 Any reason why you are using UDP instead of TCP? There might be data loss with UDP. TCP is slower, but you are guaranteed receipt of the packets. Neville. Quote Link to comment
Francois Normandin Posted July 19, 2008 Report Share Posted July 19, 2008 QUOTE (Draqo85 @ Jul 18 2008, 03:24 PM) Please help me, how to do this second program to read the same number of data which is sending this first program. Use a conditional terminal when you Read UDP data (or monitor error, timeout code = 56). If it's empty, do nothing, else append your data. Quote Link to comment
Draqo85 Posted July 19, 2008 Author Report Share Posted July 19, 2008 I want to send data to more than one computer not always in LAN connection. There will be one serwer program, and lots of clents programs , which will be reciving probes from serwer. I thought that for this situation better is UDP. Quote Link to comment
Francois Normandin Posted July 19, 2008 Report Share Posted July 19, 2008 It's only one VI, but it simulates a producer and a consumer... Download File:post-10515-1216411135.vi (LV 8.5) CCT rules!!! Quote Link to comment
Neville D Posted July 19, 2008 Report Share Posted July 19, 2008 QUOTE (Draqo85 @ Jul 18 2008, 12:49 PM) I want to send data to more than one computer not always in LAN connection.There will be one serwer program, and lots of clents programs , which will be reciving probes from serwer. I thought that for this situation better is UDP. Check out the examples TCP client-server.. there are some examples that do what you need (multiple clients). Also, you can avoid having to deal with communication if you use LabVIEW Shared variables. You can define a buffer for each variable so as to not loose data. Again, see some examples of communication using shared variables. For simple cases, it will save you a lot of time. For high performance, you might have to use TCP or UDP. Neville. Quote Link to comment
Draqo85 Posted July 20, 2008 Author Report Share Posted July 20, 2008 QUOTE (normandinf @ Jul 18 2008, 09:46 PM) Use a conditional terminal when you Read UDP data (or monitor error, timeout code = 56). If it's empty, do nothing, else append your data. I've tried doing this way, but I have still the same problem. I've check , and always its only 1024 data sent, never more. I think this is because of Windows. How to sent data in many packages. For example if I want to send more than 2000 probes, what I need to do? For my programs I'm using Daq simulations, how will this program look like for real Daq measure? Does it will be the same problem with sending data? I dont have yet NI Daq card, I want do do first program, and then I will be testing it on real NI card. Quote Link to comment
Francois Normandin Posted July 20, 2008 Report Share Posted July 20, 2008 UDP over LAN restricts you to 8192 bytes per send (1024 x 8 bits). For larger datasets, you'll need to send in many packets and find a way for your receivers to "know" how to concatenate the pieces together. Use some wrapper brackets or tags for sending large datasets. QUOTE I want to send data to more than one computer not always in LAN connection. How will you broadcast if not through a LAN? Do you have an other mean of connecting your clients to the server? A UDP is nice to avoid management of connections, but you can never be sure that the client received the data, or even how many clients are connected. For diagnostic purposes, I would tend to agree with NevilleD and use TCP. Quote Link to comment
crelf Posted July 20, 2008 Report Share Posted July 20, 2008 QUOTE (normandinf @ Jul 19 2008, 02:04 PM) A UDP is nice to avoid management of connections, but you can never be sure that the client received the data, or even how many clients are connected. ...unless you impliment your own handling on top of UDP. That said, that's not something you'll want to do unless you have some very specific needs that TCP can't provide. Quote Link to comment
Draqo85 Posted July 21, 2008 Author Report Share Posted July 21, 2008 Thanks, I've tried using TCP connection and it works:) I thought that TCP will be to slow so I've tried UDP, but now when my programs are working with TCP I see that it is even quite fast (at least for my needs). Thanks! Quote Link to comment
crelf Posted July 21, 2008 Report Share Posted July 21, 2008 QUOTE (Draqo85 @ Jul 20 2008, 10:59 AM) I thought that TCP will be to slow so I've tried UDP, but now when my programs are working with TCP I see that it is even quite fast (at least for my needs). Right - speed is certainly a vaild reason to use UDP, but only if you truly need it. Also, what are often thought of as limitations (no ability to garuntee packet delivery, no packet delivery tracking, multicasting, etc) can be very powerful (but with power comes responsibility ) TCP is great if you don't need those things, as it does it all in the background for you. Quote Link to comment
Draqo85 Posted August 7, 2008 Author Report Share Posted August 7, 2008 I have one more question. I'm using TCP connection between "serwer program" and "client program". Serwer program is running all time (send data with TCP), client program is running for a short time (collect data), when I'm starting next time client program (serwer is running all time) I can't collect data, it is working but without connection. Why? What to do if I want to collect data each time when I will run this client program? Thanks for help in advance. Quote Link to comment
Francois Normandin Posted August 7, 2008 Report Share Posted August 7, 2008 Can you post your code? Quote Link to comment
Neville D Posted August 7, 2008 Report Share Posted August 7, 2008 QUOTE (Draqo85 @ Aug 6 2008, 01:28 PM) I'm using TCP connection between "serwer program" and "client program". Serwer program is running all time (send data with TCP), client program is running for a short time (collect data), when I'm starting next time client program (serwer is running all time) I can't collect data, it is working but without connection. Why?What to do if I want to collect data each time when I will run this client program? Sometimes a search of the LAVA archives pulls up lots of http://forums.lavag.org/TCP-Listener-Wait-On-Close-Open-t3735.html' target="_blank">useful stuff. Download Jack's example from his website. It pretty much does what you want. Neville. 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.