www.pudn.com > FTP.rar > main.cpp, change:2009-06-09,size:1643b
#include "ftp_client.h"
int main(int argc, char* argv[])
{
FTP_CLIENT* ftpInst = new FTP_CLIENT();
ftpInst->analyse(CONFIG_FILE_PATH);
if( !ftpInst->ftpInit() )
{
printf("ftpInst-ftpInit error!\n");
return -1;
}
printf("ftpInst->ftpInit() finish!\n");
if ( !ftpInst->ftpCmd(ftpInst->controlSock, USER) )
{
printf("ftpInst-ftpInit send user error!\n");
return -1;
}
printf("ftpInst->ftpCmd() USER finish!\n");
if ( !ftpInst->ftpCmd(ftpInst->controlSock, PASS) )
{
printf("ftpInst-ftpInit send pass error!\n");
return -1;
}
printf("ftpInst->ftpCmd() PASS finish!\n");
/*
ftpInst->ftpCmd(ftpInst->controlSock, CWD);
printf("ftpInst->ftpCmd() CWD finish!\n");*/
if ( !ftpInst->ftpCmd(ftpInst->controlSock, PWD) )
{
printf("ftpInst-ftpInit send pwd error!\n");
return -1;
}
printf("ftpInst->ftpCmd() pwd finish!\n");
if ( !ftpInst->ftpCmd(ftpInst->controlSock, TRETR, 0, "bal.txt", FTP_CLIENT::getOneFileSize) )
{
printf("ftpInst-ftpInit send list error!\n");
return -1;
}
printf("ftpInst->ftpCmd() LIST finish! sqlnet.log size: %d\n", ftpInst->tSize);
/*ftpInst->ftpCmd(ftpInst->controlSock, RETR);
printf("ftpInst->ftpCmd() RETR finish!\n");
ftpInst->ftpCmd(ftpInst->controlSock, STOR);
printf("ftpInst->ftpCmd() STOR finish!\n");*/
if ( !ftpInst->ftpCmd(ftpInst->controlSock, QUIT) )
{
printf("ftpInst-ftpInit quit error!\n");
return -1;
}
printf("ftpInst->ftpCmd() QUIT finish!\n");
ftpInst->~FTP_CLIENT();
return 0;
}