Hello,
I need help for some FTP programming. I tried some other places, but nobody could help me. So my prob is: I want to code some FTP Client, that automatically downoads some stuff from a site. The whole thing should be or is started in WinAPÎ... with raw Sockets. I mangaged to get a connection to the FTP server, also the login and password submission works fine. The problem starts with some more advanced commands. Like List and / or Retrieve. I know the commands (got them from the RFC 959) but somehow I don't get them working. If I call for the "LIST" command, it arrives at the server, but I don't get any answer.
What do I wrong? Could anybody help me with that specific problem? Does anybody know a source of FTP Client that uses Raw Sockets?
I would be very thankful if anybody could help me!!!
chris.
(Here is some code I use.. "send" sends the message and I capture the server answer with "retrv".
bool TheFTP::entrPassv()
{
int pos;
//Set Current Working directory
sprintf(message,"CWD\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
//Print Current Working directory
sprintf(message,"pwd\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
//Set to Binary Mode
sprintf(message,"TYPE A\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
//get Passive Mode IP and Port
sprintf(message,"PASV \r\n"
send(s,message,strlen(message),0);
getServerAnswer();
//get Passive Mode stuff
pos=strcspn(bf,"("
sprintf(passivePort,&bf[pos+1]);
pos=strlen(passivePort);
passivePort[pos-3]='\0';
/*
//set Passive Mode Port
sprintf(message,"PORT *********\r\n"
//strcat(message,passivePort);
//strcat(message,"\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
*/
getDirList();
return true;
}
bool TheFTP::getDirList()
{
sprintf(message,"LIST\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
return true;
}
I need help for some FTP programming. I tried some other places, but nobody could help me. So my prob is: I want to code some FTP Client, that automatically downoads some stuff from a site. The whole thing should be or is started in WinAPÎ... with raw Sockets. I mangaged to get a connection to the FTP server, also the login and password submission works fine. The problem starts with some more advanced commands. Like List and / or Retrieve. I know the commands (got them from the RFC 959) but somehow I don't get them working. If I call for the "LIST" command, it arrives at the server, but I don't get any answer.
What do I wrong? Could anybody help me with that specific problem? Does anybody know a source of FTP Client that uses Raw Sockets?
I would be very thankful if anybody could help me!!!
chris.
(Here is some code I use.. "send" sends the message and I capture the server answer with "retrv".
bool TheFTP::entrPassv()
{
int pos;
//Set Current Working directory
sprintf(message,"CWD\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
//Print Current Working directory
sprintf(message,"pwd\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
//Set to Binary Mode
sprintf(message,"TYPE A\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
//get Passive Mode IP and Port
sprintf(message,"PASV \r\n"
send(s,message,strlen(message),0);
getServerAnswer();
//get Passive Mode stuff
pos=strcspn(bf,"("
sprintf(passivePort,&bf[pos+1]);
pos=strlen(passivePort);
passivePort[pos-3]='\0';
/*
//set Passive Mode Port
sprintf(message,"PORT *********\r\n"
//strcat(message,passivePort);
//strcat(message,"\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
*/
getDirList();
return true;
}
bool TheFTP::getDirList()
{
sprintf(message,"LIST\r\n"
send(s,message,strlen(message),0);
getServerAnswer();
return true;
}