In this two part series about FTP we are going to look at what an FTP server is and what it is used for. The first part will cover the theory and the second part will put all the theory into practice; it's where we will actually implement an FTP server. I'm doing the theory first to give you a bit of background about the FTP protocol. This will make it easy for you to understand the purpose of each command in the protocol as well as how to implement them in the next article.
FTP Server: The Theory - Commands That Manipulate (Page 5 of 5 )
Most of the rest of the commands deal with manipulating files on a file system. They include (from RFC959):
CHANGE WORKING DIRECTORY (CWD): This command allows the user to work with a different directory or dataset for file storage or retrieval without altering his login or accounting information. Transfer parameters are similarly unchanged. The argument is a pathname specifying a directory:
CWD Apathname
DELE <SP> <pathname> <CRLF>
This command causes the file specified in the pathname argument to be deleted on the computer that the server application is running.
RMD <SP> <pathname> <CRLF>
The ReMove Directory command deletes a directory located on the computer that the server application runs on.
MKD <SP> <pathname> <CRLF>
The MaKeDir command creates a new directory on the server side.
PWD <CRLF>
This command causes the name of the current working directory to be returned in the reply.
LIST [<SP> <pathname>] <CRLF>
This command displays a list of files in a given directory or path. It is perhaps the most important command of them all, simply because it enables you to see what files are available with their names, sizes, and location indicated. Without this information, you would not be able to do any file manipulation at all.
Conclusion
I cannot emphasize enough the need for you to avail yourself of the RFC 959 when implementing an FTP server. Once you have a better understanding of how it all works together, you will not have any problems implementing an FTP server. In the next article we are going to look at how to implement a custom FTP server using Delphi.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.