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. How to make fast FTP client?

How to make fast FTP client?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++question
3 Posts 2 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
    Gofur Halmurat
    wrote on last edited by
    #1

    Hello, I have finished writing ftp client in c/c++ using system funtion to get/put ftp commands for example:

    int FTPGet(char *asFtpSite, char *asFtpUser, char *asFtpPasswd, char* asRemoteDir,
    char *asRemoteFile, char *asLocalFile, char *asLogFile)
    {
    char lsFtpCommand[4096];

    sprintf(lsFtpCommand,
    "export LANG=en_US\n"
    "ftp -i -v -n >%s <<EOJ\n"
    "open %s\n"
    "user %s %s\n"
    "ascii\n"
    "cd %s\n"
    "get %s %s\n"
    "bye\n"
    "EOJ\n",
    asLogFile,
    asFtpSite,asFtpUser,asFtpPasswd,
    asRemoteDir,
    asRemoteFile,asLocalFile);

    system(lsFtpCommand);
    return 0;

    }

    It works fine, but very slow, I found out it is why because i use "system" function, What i want to ask from u, Is there any other method to make it faster? I am told that there is a ftp library for C, which is cURL, somebody has ever tried it? or Is There any other ftp library which works faster? My platform is IBM AIX unix. Thanks in advance

    It is never late to learn

    G 1 Reply Last reply
    0
    • G Gofur Halmurat

      Hello, I have finished writing ftp client in c/c++ using system funtion to get/put ftp commands for example:

      int FTPGet(char *asFtpSite, char *asFtpUser, char *asFtpPasswd, char* asRemoteDir,
      char *asRemoteFile, char *asLocalFile, char *asLogFile)
      {
      char lsFtpCommand[4096];

      sprintf(lsFtpCommand,
      "export LANG=en_US\n"
      "ftp -i -v -n >%s <<EOJ\n"
      "open %s\n"
      "user %s %s\n"
      "ascii\n"
      "cd %s\n"
      "get %s %s\n"
      "bye\n"
      "EOJ\n",
      asLogFile,
      asFtpSite,asFtpUser,asFtpPasswd,
      asRemoteDir,
      asRemoteFile,asLocalFile);

      system(lsFtpCommand);
      return 0;

      }

      It works fine, but very slow, I found out it is why because i use "system" function, What i want to ask from u, Is there any other method to make it faster? I am told that there is a ftp library for C, which is cURL, somebody has ever tried it? or Is There any other ftp library which works faster? My platform is IBM AIX unix. Thanks in advance

      It is never late to learn

      G Offline
      G Offline
      Garth J Lancaster
      wrote on last edited by
      #2

      I havnt used libCurl, there's also libwww http://www.w3.org/Library/[^] which also looks promising... you say its slow, and thats becuase you use the 'system' function .. what do you mean by slow ? I would have thought that once a shell had been spawned using system it could handle that easily, unless it does a truckload of parsing etc to read the commands from stdin/the input 'stream' Is your system having other difficulties, like with memory or network connection issues ?? I'll see if I can test it on Solaris tomorrow...

      G 1 Reply Last reply
      0
      • G Garth J Lancaster

        I havnt used libCurl, there's also libwww http://www.w3.org/Library/[^] which also looks promising... you say its slow, and thats becuase you use the 'system' function .. what do you mean by slow ? I would have thought that once a shell had been spawned using system it could handle that easily, unless it does a truckload of parsing etc to read the commands from stdin/the input 'stream' Is your system having other difficulties, like with memory or network connection issues ?? I'll see if I can test it on Solaris tomorrow...

        G Offline
        G Offline
        Gofur Halmurat
        wrote on last edited by
        #3

        Thanks for reply. What i mean by slow was that when u want get file from ftp server and save it to your localhost or such operations works very slow, and i think it is from why i use "system" function in c, if i use other low level OS function, it could be faster such as Curl or something else.

        It is never late to learn

        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