Sequencing of Commands and Replies
The communication between the user and server is intended to be an alternating dialogue. As such, the user issues an FTP command and the server responds with a prompt primary reply. The user should wait for this initial primary success or failure response before sending further commands.
Certain commands require a second reply for which the user should also wait. These replies may, for example, report on the progress or completion of file transfer or the closing of the data connection. They are secondary replies to file transfer commands.
The third class of replies are informational and spontaneous replies which may arrive at any time. The user-PI should be prepared to receive them. These replies are listed below as sponteneous.
One important group of spontaneous replies is the connection greetings. Under normal circumstances, a server will send a 300 reply, "awaiting input", when the ICP is completed. The user should wait for this greeting message before sending any commands. If the server is unable to accept input right away, he should send a 000 "announcing FTP" or a 020 "expected delay" reply immediately and a 300 reply when ready. The user will then know not to hang up if there is a delay.
The table below lists alternative success and failure replies for each command. These must be strictly adhered to; a server may substitute text in the replies, but the meaning and action implied by the code numbers and by the specific command reply sequence cannot be altered.
COMMAND-REPLY CORRESPONDENCE TABLE
COMMAND SUCCESS FAILURE
USER 230,330 430-432,500-505,507
PASS 230,330 430-432,500-507
ACCT 230 430-432,500-507
REIN 232,233 401,436,500-507
Secondary Reply 300
BYE 231,232 500-505,507
BYTE 200,331 402,500-505,507
SOCK 200,331 500-505,507
PASV 200,331 500-507
TYPE 200,331 402,500-505,507
STRU 200,331 500-505,507
MODE 200,331 402,500-505,507
RETR 250 402,433,450,451,454,455,457,
500-505,507,550
Secondary Reply 252,257 452
STOR 250 402,433,451,454,455,457,
500-505,507,550
Secondary Reply 252,257 452,453
APPE 250 402,433,451,454,455,457,500-507,
550
Secondary Reply 252,257 452,453
ALLO 200,331 402,500-507
REST 200,331 500-507
RNFR 200 402,433,450,451,455,500-507,550
RNTO 253 402,433,450,451,455,456,500-507,
550
ABOR 201,202,331 500-507
DELE 254 402,433,450,451,455,500-507,550
LIST 250 402,433,450,451,454,455,457,
500-507,550
Secondary Reply 252,257 452
NLST 250 402,433,450,451,454,455,457,
500-507,550
Secondary Reply 252,257 452
SITE 200,331 402,500-507
STAT 100,110, 450,451,455,500-507,550
150,151,331
HELP 030,050 500-507
NOOP 200 500-505,507
Spontaneous Replies 000,010,020, 400,401,434-436
300,301,251,255