LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File transfer using UDP

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

0 Kudos
Message 1 of 22
(5,309 Views)

Hi Hima,

 

UDP is not a good protocol for transferring files as it does not guarantee every packet gets through. I'm surprised you are losing som much but we will only be patching that fundamental issue. You should really use TCP or better just use FTP or WebDAV which handles all the complications for you.

 

What are you trying to achieve?

 

Cheers,

James

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 2 of 22
(5,293 Views)

Hi,

 

I have tried sending data with 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

0 Kudos
Message 3 of 22
(5,290 Views)

Hi Hima,


Why does it require UDP? It really isn't the right tool for the job!

 

If you must use UDP then you will have to add some handshaking, you need some way for the client to tell the server that part of the file is missing and it must be resent. There is no way to guarantee every UDP packet without some handshaking on top (This is one of the things that TCP adds natively over UDP)

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 4 of 22
(5,286 Views)

Hi James,

 

So what could be the other option of communication other than Udp for a simplex route. (data sent from server to client and no response from client end)

 

We cannot get any feedback from the client for our work. 

 

Do you have any suggestions which protocol is to be used other than UDP?

 

Thanks, 

Hima

0 Kudos
Message 5 of 22
(5,282 Views)

@skshatri wrote:

So what could be the other option of communication other than Udp for a simplex route. (data sent from server to client and no response from client end)


The stupid question: What is keeping the server from being able to recieve status, requests, etc?  How does the server even know when to send the file?  How does it even know there is a connection to a client to be made?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 22
(5,273 Views)

Hi,

 I give the Ip address of the client and the port number at the server end.

 

The client with the same port number waits for the port number from the server to match and then reads the data sent from the server.

 

Ask me if it's still not clear 🙂

 

Thanks,

Hima 

 

0 Kudos
Message 7 of 22
(5,270 Views)

What drives the need for a simplex communication method? You would need some level of feedback to guarantee transmission. The nature of IP networks means some packets will be lost which means when they are, you need to know there is some data missing so you can request it.

 

Detection of missing data can be by numbering sections and some form of checksum to guarantee everything is there, but that would still require some sort of feedback, unless there is something I am missing. Protocols do exist on UDP but they seem to always use a return path to acknowledge data like https://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol

 

It is like standing across a rail station shouting to someone across the other side, if a train goes past, unless they shout "What?!" I can't guarantee they have heard everything.

 

 

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
Message 8 of 22
(5,269 Views)

Hi James,

I understand the risk of using Udp concerning the loss of data.

I will try to implement tftp protocol for the server and client communication.

 

Thanks,

Hima

 

0 Kudos
Message 9 of 22
(5,262 Views)

Are you trying to send the entire file in a single UDP Write, or are you splitting it up into multiple writes? And, same question for the receiving end.

0 Kudos
Message 10 of 22
(5,226 Views)