FTP Commands and Replies

FTP Commands and Replies

We finish this section with a brief discussion of some of the more common FTP commands and replies. The commands, from client to server, and replies, from server to client, are sent across the control connection in 7-bit ASCII format. Therefore, like HTTP commands, FTP commands are readable by people. In order to define successive commands, a carriage return and line feed end each command. Each command is made of four uppercase ASCII characters, some with optional arguments. Some of the more common commands are given below:

●  USER username: Used to send the user identification to the server.

●  PASS password: Used to send the user password to the server.

●  LIST: Used to ask the server to send back a list of all the files in the current remote directory. The list of files is sent over a (new and non-persistent) data connection rather than the control TCP connection.

●  RETR filename: Used to retrieve (that is, get) a file from the current directory of the remote host. This command causes the remote host to initiate a data connection and to send the requested file over the data connection.

●  STOR filename: Used to store (that is, put) a file into the current directory of the remote host.

There is normally a one-to-one correspondence between the command that the user issues and the FTP command sent across the control connection. Each command is followed by a reply, sent from server to client. The replies are three-digit numbers, with an optional message following the number. This is similar in structure to the status code and phrase in the status line of the HTTP response message. Some usual replies, along with their possible messages, are as follows:

●  331 Username OK, password required

●  125 Data connection already open; transfer starting

●  425 Canít open data connection

●  452 Error writing file

Readers who are interested in learning about the other FTP commands and replies are encouraged to read RFC 959.


ftp commands, tcp connection, remote host, http commands, server

Copy Right

The contents available on this website are copyrighted by TechPlus unless otherwise indicated. All rights are reserved by TechPlus, and content may not be reproduced, published, or transferred in any form or by any means, except with the prior written permission of TechPlus.