08-17-2016 07:25 AM
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
08-17-2016 07:52 AM
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
08-17-2016 07:56 AM
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
08-17-2016 08:03 AM
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)
08-17-2016 08:06 AM
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
08-17-2016 08:15 AM
@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?
08-17-2016 08:20 AM
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
08-17-2016 08:21 AM
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.
08-17-2016 08:28 AM
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
08-17-2016 12:33 PM
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.