04-22-2012 03:55 PM
and that was my question from the begining, how can i break down this huge file into small pieces in labview??
04-22-2012 04:03 PM
Don't read all of it at once.
You read portions of it at a time and do it repetitively in a loop. Turn on context help and you'll see the File Read function as an input that allows you to wire in a number of bytes you want to read.
04-23-2012 10:33 AM
@omar21 wrote:
for GOD sake, this is my VI, i know TCP is better, but i just wanna see it working with UDP, so tell me how shall i modify it to not see this error message anymore 😞
Yes, simply place a while loop around the udp send and the file read and do the equivalent at the receiving end. You can specify how much you want to read from the file by wiring the count input and it will read that amount per iteration. You should prepend the portion size to each transmission so the receiver knows how much to read with each iteration. (It cannot be constant, because the file size might not be evenly divisible. Look at the examples.
As has been said, there will be a near 100% chance that the the data will be corrupted, because the receiving end will not be able to determine if a portion is missing. Even on a perfect network, there can be packet loss. If that occurs, you'll never see an error message but some parts will never arrive. Your task should not be the elimination of an error message, but a reliable file transfer.
Using UDP is just plain silly. It is like trying to enter a bicycle race with a jet ski. Sure it looks faster on paper but it won't get you anywhere on dry land.
04-23-2012 10:50 AM
I have done that, and it is as you predicted, i don't see the error message anymore, and i managed to transfer the whole file, but it ended up as a corrupted one 🙂 , however i am faced with a strange situation: the VIS work only in the block diagram interface, when i switch to the user interface, they don't work at all, and labview crashes!!
"You should prepend the portion size to each transmission so the receiver knows how much to read with each iteration. (It cannot be constant, because the file size might not be evenly divisible", can you explain further ?
04-23-2012 10:59 AM
@omar21 wrote:
...however i am faced with a strange situation: the VIS work only in the block diagram interface, when i switch to the user interface, they don't work at all, and labview crashes!!
I don't understand what you mean by interface in this context. can you explain?
04-23-2012 11:05 AM
the block diagram interface is the area where i write the code, and the user interface is that grey one: the front panel. as i said, to have my VIs work perfectly and go through the "while loop", i must turn on the "highlight execution" button, if this button is left off, my loop goes into only one iteration, it may seem meaningless, but this is really happening
04-23-2012 11:27 AM
Looks like you have a race condition. Show us your code. (execution highlighting has nothing to do with front panel vs. block diagram)
04-23-2012 11:37 AM
logically, this is the case, execution highlighting has nothing to do with program code, anyway here is my VI
04-23-2012 11:59 AM
04-23-2012 12:44 PM
okey, here are my VIs, you need to run UDP file client VI first, then run the UDP file server. just a small remark, these VIs are built in labview 8.5