FTP Server: The Theory - Explaining the Exchange
(Page 2 of 5 )
I’m using telnet (acting as the FTP client in this case) to access the FTP server that I created. As you can see, the server sends a welcome message to the client before authentication. I then typed the command “user” and gave my dummy username “myusername.” The server responded by saying “user name okay, need password.” I then typed the command “pass” and entered my dummy password which is “mypassword.” The password was accepted and gave me access to the FTP server. You can see from this communication that the server uses different numbers depending on the message. Below are some of the codes as defined in RFC 959:
200 Command okay.
500 Syntax error, command unrecognized.
This may include errors such as command line too long.
501 Syntax error in parameters or arguments.
202 Command not implemented, superfluous at this site.
502 Command not implemented.
503 Bad sequence of commands.
504 Command not implemented for that parameter.
230 User logged in, proceed.
530 Not logged in.
331 User name okay, need password.
332 Need account for login.
532 Need account for storing files.
I haven't listed all the reply codes, but as you can see from the above, they are very easy to understand. For a fuller explanation of these codes, consult the RFC 959.
We already stated that an FTP server makes files available to the FTP client. Well, that is one function of an FTP server. In addition to that, the FTP server also enables a user to manipulate these files. For example, you can download, move, delete, rename and upload files. You can also get information about a file such as its last modified date or its size. All of this is achieved through commands. For example, to look at all the files in a directory you will need to call the LIST command, or to get a file from the server you call the RETR command.
Next: FTP Commands >>
More Delphi-Kylix Articles
More By Leidago