LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

file transfer using UDP protocol

and that was my question from the begining, how can i break down this huge file into small pieces in labview??

0 Kudos
Message 21 of 42
(1,015 Views)

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.

0 Kudos
Message 22 of 42
(1,012 Views)

@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.

0 Kudos
Message 23 of 42
(992 Views)

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 ?

0 Kudos
Message 24 of 42
(987 Views)

@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?



0 Kudos
Message 25 of 42
(985 Views)

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

0 Kudos
Message 26 of 42
(986 Views)

Looks like you have a race condition. Show us your code. (execution highlighting has nothing to do with front panel vs. block diagram)

0 Kudos
Message 27 of 42
(982 Views)

logically, this is the case, execution highlighting has nothing to do with program code, anyway here is my VI

0 Kudos
Message 28 of 42
(978 Views)
You did not attach any code, just some image. We cannot run or debug an image and critical information is hidden. For example what is the mechanical action setting of the stop button
0 Kudos
Message 29 of 42
(972 Views)

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

Download All
0 Kudos
Message 30 of 42
(967 Views)