JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Okay,
I've read a few things in different places on how to set up the basic functionality of FTP communication using Windows Sockets, (System.Net.Sockets Namespace, Socket Class) at it seems pretty straight forward. You send a command to the FTP and then read the responses and parse the response CODES (like 200, 220, 150, 226, 331, etc) and voila you can send a command and get a response from the FTP. However, how do program in the downloading of a file? The Socket class has a SendFile() method but no RecieveFile() method, so I were to send the command to the FTP:
GET thisfile.txt
or
RETR myfile.txt
How would I receive it on my end?
One of the tutorials I read had a constant named SENDING_DATA_ON_PORT_20, which equated to the 150 FTP response code, which happens when sending ASCII on /bin/ls (or dir for a directory listing) as well as when invoking a GET/RETR command. With applications like WS_FTP and hell, even the CMD shell FTP program, they seem to be able to do this, but I have found nothing out there that says: Here is how you retrieve an ASCII file mode transfer from an FTP server, and here is how you retrieve a BINARY file mode transfer form an FTP server.
Could anyone point me in the right direction to learn how to do this? As well as gain file information specifics from the FTP server instead of parsing the DIR or (LS -l) response text.
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
I've read a few things in different places on how to set up the basic functionality of FTP communication using Windows Sockets, (System.Net.Sockets Namespace, Socket Class) at it seems pretty straight forward. You send a command to the FTP and then read the responses and parse the response CODES (like 200, 220, 150, 226, 331, etc) and voila you can send a command and get a response from the FTP. However, how do program in the downloading of a file? The Socket class has a SendFile() method but no RecieveFile() method, so I were to send the command to the FTP:
GET thisfile.txt
or
RETR myfile.txt
How would I receive it on my end?
One of the tutorials I read had a constant named SENDING_DATA_ON_PORT_20, which equated to the 150 FTP response code, which happens when sending ASCII on /bin/ls (or dir for a directory listing) as well as when invoking a GET/RETR command. With applications like WS_FTP and hell, even the CMD shell FTP program, they seem to be able to do this, but I have found nothing out there that says: Here is how you retrieve an ASCII file mode transfer from an FTP server, and here is how you retrieve a BINARY file mode transfer form an FTP server.
Could anyone point me in the right direction to learn how to do this? As well as gain file information specifics from the FTP server instead of parsing the DIR or (LS -l) response text.
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner