Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Sending File Through UDP

Sending File Through UDP

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Girish601
    wrote on last edited by
    #1

    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

    R M L 3 Replies Last reply
    0
    • G Girish601

      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

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • G Girish601

        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

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        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");

        N 1 Reply Last reply
        0
        • M Michael Dunn

          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");

          N Offline
          N Offline
          neilsolent
          wrote on last edited by
          #4

          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

          G 1 Reply Last reply
          0
          • G Girish601

            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

            L Offline
            L Offline
            Luke Lovegrove
            wrote on last edited by
            #5

            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 ------------------------

            1 Reply Last reply
            0
            • N neilsolent

              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

              G Offline
              G Offline
              Girish601
              wrote on last edited by
              #6

              Hello Neil, Thanx for your timely suggestion Can i know exactly further how should i go ahead. I want to send a file through UDP. I am aware of it using in TCP. Can i know how it is done in UDP Thanx in Advance

              Girish Software Developer

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups