skshatri Posted August 17, 2016 Report Share Posted August 17, 2016 Hello, I am using UDP to transfer files from server to client but I cannot receive the complete file. I can receive only a part of it. For example if the size of the file to be sent is 25 MB, I am receiving only 60 KB at the client end. Please help me with your suggestions. UDP file tranfer examples would be helpful. Thankyou, Hima Quote Link to comment
austinman Posted August 17, 2016 Report Share Posted August 17, 2016 Hima, UDP is a lossy protocol. There is no guarantee that all the data will arrive at the listener. This could be one reason you are seeing data loss. Have you considered usiing TCP/IP, a much more robust protocol? Quote Link to comment
skshatri Posted August 17, 2016 Author Report Share Posted August 17, 2016 Hi austinman, I have tried sending data through TCP and it works perfect but my project demands the UDP transmission. Simplex communication. So I am working on UDP communication.. i.e., Transfer of complete file from sender to receiver. Thanks, Hima Quote Link to comment
Phillip Brooks Posted August 17, 2016 Report Share Posted August 17, 2016 Are the client and server both running LabVIEW? Do you have tftp client or server available on either of the systems? tftp is UDP based, but takes care of the handshaking. https://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol Quote Link to comment
Tim_S Posted August 17, 2016 Report Share Posted August 17, 2016 6 minutes ago, Phillip Brooks said: Are the client and server both running LabVIEW? Do you have tftp client or server available on either of the systems? tftp is UDP based, but takes care of the handshaking. https://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol To add to this, there is an implementation in LabVIEW at: https://decibel.ni.com/content/docs/DOC-8301 Quote Link to comment
Popular Post Neil Pate Posted August 17, 2016 Popular Post Report Share Posted August 17, 2016 The best thing about UDP jokes is that I don't care if you get them or not. 7 Quote Link to comment
Tim_S Posted August 17, 2016 Report Share Posted August 17, 2016 1 hour ago, Neil Pate said: The best thing about UDP jokes is that I don't care if you get them or not. Boo. Hiss. Cheer... Quote Link to comment
ShaunR Posted August 17, 2016 Report Share Posted August 17, 2016 3 hours ago, Neil Pate said: The best thing about UDP jokes is that I don't care if you get them or not. The best thing I like about *any* jokes is you get more likes than if you answer questions ( ͡~ ͜ʖ ͡~) 1 Quote Link to comment
hooovahh Posted August 17, 2016 Report Share Posted August 17, 2016 11 minutes ago, ShaunR said: The best thing I like about *any* jokes is you get more likes than if you answer questions ( ͡~ ͜ʖ ͡~) Is that a joke? Cause I like that. Quote Link to comment
MikaelH Posted August 17, 2016 Report Share Posted August 17, 2016 10 hours ago, skshatri said: Hello, I am using UDP to transfer files from server to client but I cannot receive the complete file. I can receive only a part of it. For example if the size of the file to be sent is 25 MB, I am receiving only 60 KB at the client end Can you post your code? How big do you make the UDP packages? I guess you know that a one UDP package could only be 65,507 bytes So you need to split them into multiple packages with some header data, so you can see that you have received them all and put them together in the correct order. Quote Link to comment
smithd Posted August 18, 2016 Report Share Posted August 18, 2016 (edited) 7 hours ago, MikaelH said: So you need to split them into multiple packages with some header data, so you can see that you have received them all and put them together in the correct order. This would also require acks which means bidirectional communication (vs: " my project demands the UDP transmission. Simplex communication."). I don't think there is a way to do this with that constraint, and if you don't have that constraint then tcp or ftp will work. Edited August 18, 2016 by smithd Quote Link to comment
Neil Pate Posted August 18, 2016 Report Share Posted August 18, 2016 I gave quite serious thought to whether I should post or not as I did not really want to derail the thread. However, that joke is perhaps in my top two of tech jokes I know, it is too good to not share. The other one is.. “Whenever faced with a problem, some people say `Lets use AWK.' Now, they have two problems.” Quote Link to comment
ShaunR Posted August 18, 2016 Report Share Posted August 18, 2016 (edited) 11 hours ago, hooovahh said: Is that a joke? Cause I like that. Tongue in cheek..(What? No likes 8 hours ago, smithd said: This would also require acks which means bidirectional communication (vs: " my project demands the UDP transmission. Simplex communication."). I don't think there is a way to do this with that constraint, and if you don't have that constraint then tcp or ftp will work. Transport.lvlib 2 hours ago, Neil Pate said: I gave quite serious thought to whether I should post or not You think too much Too many engineers have their sense of humour beaten out of them by unrealistic marketing requirements and customer demands. Post and be damned My current favourite is: Linux is Windows 95 without the GUI. Edited August 18, 2016 by ShaunR Quote Link to comment
skshatri Posted August 18, 2016 Author Report Share Posted August 18, 2016 10 hours ago, MikaelH said: Can you post your code? How big do you make the UDP packages? I guess you know that a one UDP package could only be 65,507 bytes So you need to split them into multiple packages with some header data, so you can see that you have received them all and put them together in the correct order. Hi,. Here is my code. please go through it. client.vi server.vi Quote Link to comment
hooovahh Posted August 18, 2016 Report Share Posted August 18, 2016 Crosspost Honestly not sure which thread has more discussion. (BTW Shaun I gave you a like) 1 Quote Link to comment
MikaelH Posted August 18, 2016 Report Share Posted August 18, 2016 Here is a quick example UDP_FileReceiver.vi UDP_FileSender.vi Quote Link to comment
Neil Pate Posted August 19, 2016 Report Share Posted August 19, 2016 7 hours ago, MikaelH said: Here is a quick example UDP_FileReceiver.vi UDP_FileSender.vi But without any kind of re-transmission in the case of errors which is where this whole exercise starts to become tricksy. Caveat emptor... Quote Link to comment
Rolf Kalbermatter Posted August 19, 2016 Report Share Posted August 19, 2016 (edited) On 18-8-2016 at 0:46 AM, MikaelH said: I guess you know that a one UDP package could only be 65,507 bytes And that is neither guaranteed to work! Depending on gateways and other limitations on the everchanging interweb of IP, an IP packet exceeding the minimum MTU of 576 for IPv4 may be dropped for any reason that any router device on the way may feel like, including scarce internal memory or CPU resources, or just a temporary mood of the day. And a single dropped or corrupted IP fragment in a complete UDP packet will cause the entire UDP packet to be refused (dropped) by the receiving UDP endpoint. Since the IP packet also needs to contain the IP and UDP header, the actual "safe" minimum maximum UDP packet size is really more like 508 bytes (accounting for extra IP options in the header). The maximum size of an UDP packet of 64kB is a Windows feature. Other socket implementations can use lower limits. The 64kB is also the theoretical maximum limit, since UDP only uses a 16 bit length indicator in its header, so it can't really transmit more than 64kB in a single packet. And UDP itself does not provide for a mechanisme to fragment and reassemble bigger packets. So I'm pretty sure all the socket implementations out there, simply cap any attempt of a user application to transmit more than those 64kB. You could argue that LabVIEW as high level programming environment should produce an error if you try to send more, but that is a pretty fuzzy idea. Nothing in the UDP implementation guarantees the transmission of any packet size across the network, so why bother to create an error? Also, if the entire route from sender to receiver is guaranteed to be IPv6, all the above changes considerably. The MTU changes to about 2000 bytes and by using IPv6 jumbograms, UDP can transmit larger packets than 64B. So above limitation doesn't apply but since the LabVIEW network nodes currently only support IPv4 anyways, this is of no concern in terms of LabVIEW programming. Edited August 19, 2016 by rolfk 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.