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. Ftp : how to know downloading data is completed?

Ftp : how to know downloading data is completed?

Scheduled Pinned Locked Moved C / C++ / MFC
questionsysadminlinuxtutorial
3 Posts 3 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.
  • I Offline
    I Offline
    includeh10
    wrote on last edited by
    #1

    here is data (in ASCII format) downloaded from server by command "LIST":

    total 1100
    -rw------- 1 root 38 Dec 16 2010 .bash_history
    (omitting several lines here)
    drwx--x--x 6 other 512 Oct 13 2005 usr

    My question is: How do I know the downloading is completed? I guess I need to send count of bytes downloaded to server, so server will tell if downloading is OK. If so, What instruction (command) should I send to server? Which port (command port or data port) should I use for sending the instruction? Thanks. .

    L J 2 Replies Last reply
    0
    • I includeh10

      here is data (in ASCII format) downloaded from server by command "LIST":

      total 1100
      -rw------- 1 root 38 Dec 16 2010 .bash_history
      (omitting several lines here)
      drwx--x--x 6 other 512 Oct 13 2005 usr

      My question is: How do I know the downloading is completed? I guess I need to send count of bytes downloaded to server, so server will tell if downloading is OK. If so, What instruction (command) should I send to server? Which port (command port or data port) should I use for sending the instruction? Thanks. .

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Is this something to do with C++ or are you just trying to understand how to use FTP? If you are doing this programmatically then you just keep reading the socket until no more data is presented.

      includeh10 wrote:

      Which port (command port or data port) should I use

      Not sure that I understand your question here; what do you mean by "command port or data port"?

      speaking as ...

      1 Reply Last reply
      0
      • I includeh10

        here is data (in ASCII format) downloaded from server by command "LIST":

        total 1100
        -rw------- 1 root 38 Dec 16 2010 .bash_history
        (omitting several lines here)
        drwx--x--x 6 other 512 Oct 13 2005 usr

        My question is: How do I know the downloading is completed? I guess I need to send count of bytes downloaded to server, so server will tell if downloading is OK. If so, What instruction (command) should I send to server? Which port (command port or data port) should I use for sending the instruction? Thanks. .

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #3

        See RFC 959[^], section 4.2 (FTP Replies). Just check for three digits followed by a space at the begin of each line. With the LIST command, it is usually the code 250 followed by server dependant text, e.g.:

        125 List started OK.
        [list output]
        250 List completed successfully.

        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