Sending File Through UDP
-
Hello Friends Can any body on the forum Could help me out in knowning how can one Send a file through UDP. Is there any specific function for the doing the same, or any separate mechanism is required. My following requirement is for VC++ 7.1/6.0
Girish Software Developer
-
Hello Friends Can any body on the forum Could help me out in knowning how can one Send a file through UDP. Is there any specific function for the doing the same, or any separate mechanism is required. My following requirement is for VC++ 7.1/6.0
Girish Software Developer
Why would you send a file using UDP? UDP is connectionless which means that there's no guarantee that the packet will reach the receiver. Under normal circumstances it would reach the receiver, but you cannot assume that. Thus parts of you file may be lost during the transmission. On the other hand; using UDP is exactly the same as using TCP. You open a socket and send to a receiving socket providing the address and port. Hope this helps -- Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998
"...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above -
Hello Friends Can any body on the forum Could help me out in knowning how can one Send a file through UDP. Is there any specific function for the doing the same, or any separate mechanism is required. My following requirement is for VC++ 7.1/6.0
Girish Software Developer
UDP is the wrong protocol to use for file transfers. There is no guarantee that packets will even arrive at the destination.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ");
-
UDP is the wrong protocol to use for file transfers. There is no guarantee that packets will even arrive at the destination.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ");
I don't agree that UDP is "wrong". It depends on the application. For example UDP is massively better than TCP if you want to multicast to multiple hosts. But yes, you do have to handle transmission problems yourself - you don't get return codes from the APIs that you do with TCP. It is also difficult to make UDP secure - then again TCP isn't secure on its own (needs a security layer such as SSL).
cheers, Neil
-
Hello Friends Can any body on the forum Could help me out in knowning how can one Send a file through UDP. Is there any specific function for the doing the same, or any separate mechanism is required. My following requirement is for VC++ 7.1/6.0
Girish Software Developer
As already mentioned, it isn't a good idea to do file transfer over UDP given it is connectionless. Doing it over TCP (with or without a security layer) will be easier and more reliable. I believe that the TFTP system is designed to transfer files over UDP. Although TFTP isn't really used these days, I think from memory that the process of remote booting a workstation uses it, and transfers the boot image from the server to the client over UDP. Therefore, if you absolutely must transfer a file over UDP and have no other options, see if you can find an open source TFTP program to give you some pointers on how to do it. Most likely you will find the code to be *nix oriented though. You may even be lucky enough to find a TFTP library you can use as well.
------------------------ Luke Lovegrove ------------------------
-
I don't agree that UDP is "wrong". It depends on the application. For example UDP is massively better than TCP if you want to multicast to multiple hosts. But yes, you do have to handle transmission problems yourself - you don't get return codes from the APIs that you do with TCP. It is also difficult to make UDP secure - then again TCP isn't secure on its own (needs a security layer such as SSL).
cheers, Neil