Discussion:
How does one send a file via UDP?
(too old to reply)
jlivermore
2008-08-07 00:10:05 UTC
Permalink
I need to send a binary file via UDP. The file has 99 32-bit binary words of data. How do I input the data to the UDP write command? I don't want to send the data sequentially..I would like to send all 99 words in a single UDP transmission. TIA.:smileysad:
-jlivermore
Ravens Fan
2008-08-07 02:40:05 UTC
Permalink
You need to convert the 99 32-bit values into 396 8-bit values.  Cast that to a string and feed it into the UDP write.  Do the opposite on  the UDP read end.
jlivermore
2008-08-07 15:10:05 UTC
Permalink
Thanks, Ravens Fan.
-jlivermore
mikeporter
2008-08-07 03:10:05 UTC
Permalink
Something to be careful of is that while UDP is fast, it is not secure. You can lose packets and there is no way for the sender or receiver to know it was lost. Because UDP doesn't have a "connection" like TCP does, the sender doesn't know if the data is going anywhere and the receivers have no way of knowing if anything is being sent. Picture a radio station. A guy working the night shift hopes there is someone somewhere listening to his broadcast, but he doesn't know. Likewise, if you turn on a radio and hear nothing but static, you may be listening to a frequency where there are no stations broadcasting, or the station transmitter might be off the air, or there might be interference keeping you from hearing the signal, but again you don't know which.Mike...
jlivermore
2008-08-07 15:10:05 UTC
Permalink
Thanks, Mike. I am using UDP only because I am new to labVIEW and it is easier for me, at this point, to use it than TCP/IP. Once I get everything working in UDP, I will switch to TCP/IP. Thanks for the feedback.
-jlivermore
mikeporter
2008-08-08 02:40:06 UTC
Permalink
You might want to check the TCP examples, I believe there is one that transfers files. Mike...
Loading...