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