FTP and Ports

When FTP is running on a server, it constantly monitors port 21, the FTP control port, for a request for service from the FTP server. To connect to the FTP server, the FTP client computer sends a request to TCP port number 21 on the server computer.

For example, assume that computer A is the FTP client, computer B is the FTP server, and that they have the following IP addresses.

Computer A (FTP client)

Computer B (FTP server)

IP address: 172.16.16.10

IP address: 10.155.22.99


The communication between the FTP client and FTP server follows this process.

  1. At the command prompt on computer A, the user types the following information:

FTP 10.155.22.99

  1. The operating system assigns a TCP port number greater than 1023 (for example, 1028) to the FTP client application.
  2. TCP creates a packet that includes the following information:

Source IP Address

172.16.16.10

Source TCP Port Number

1028

Destination IP Address

10.155.22.99

Destination TCP Port Number

21


  1. The packet is sent across the network to IP address 10.155.22.99.
  2. Computer B receives the packet and TCP forwards the packet to port 21 (FTP control).
  3. The FTP service on computer B sends an acknowledgment (ACK) back to computer A by using both the IP address (172.16.16.10) and the port number (1028).

The packet cannot be accidentally delivered to a wrong port address on the server because the packet contains the correct port number before it leaves the client computer.